2017 © Pedro Peláez
 

symfony-bundle api-bundle

Api bundle for ONGR platform.

image

ongr/api-bundle

Api bundle for ONGR platform.

  • Thursday, August 4, 2016
  • by saimaz
  • Repository
  • 17 Watchers
  • 10 Stars
  • 6,689 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 11 Forks
  • 5 Open issues
  • 7 Versions
  • 2 % Grown

The README.md

ONGR Api Bundle

Api Bundle allows rapid setup of RESTful API to simplify Elasticsearch data access for the remote clients., (*1)

Build Status, (*2)

Documentation, (*3)

The source of the documentation is stored in the Resources/doc/ folder in this bundle., (*4)

Read the API Bundle Documentation, (*5)

Setup the bundle

This example assumes that you already have configured Elasticsearch bundle. If you haven't, here's a quick setup guide on how to do it., (*6)

Step 1: Install

Api bundle is installed using Composer., (*7)

composer require ongr/api-bundle "~1.0"

Step 2: Enable bundle in the AppKernel

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new JMS\SerializerBundle\JMSSerializerBundle(),
        new ONGR\ElasticsearchBundle\ONGRElasticsearchBundle(),
        new ONGR\ApiBundle\ONGRApiBundle(),
    );
}

API Bundle requires JMS Serializer to work with JSON and XML, (*8)

Step 3: Add configuration

Add minimal configuration for Api bundle to the config.yml., (*9)

#app/config/config.yml

ongr_api:
    default_encoding: json
        versions:
            v3:
                endpoints:
                    product:
                        repository: es.manager.default.product

The example above shows a minimal configuration. To learn more take a look at the configuration page., (*10)

Add routing, (*11)

#app/config/routing.yml

ongr_api_routing:
    resource: @ONGRApiBundle/Resources/config/routing.yml
    prefix: /api

You can specify prefix like you want, api is only the example., (*12)

Step 4: That's it

Its ready to use. API Bundle will generate new url endpoints by your configuration, by previous configuration you will have: <yourdomain.com>/api/v3/product, (*13)

What's next ?

Head to configuration page to learn how to get most of your API or take a look at the [basic usage example][6], (*14)

License

This bundle is covered by the MIT license. Please see the complete license in the bundle LICENSE file., (*15)

The Versions