ongr / api-bundle
Api bundle for ONGR platform.
Installs: 11 831
Dependents: 2
Suggesters: 0
Security: 0
Stars: 8
Watchers: 19
Forks: 9
Open Issues: 5
Type:symfony-bundle
Requires
- php: >=5.5
- jms/serializer-bundle: ~1.0
- ongr/elasticsearch-bundle: ~1.0
- sensio/framework-extra-bundle: ^3.0
- symfony/symfony: ~2.7|~3.0
Requires (Dev)
- phpunit/phpunit: ~4.4
- satooshi/php-coveralls: ~1.0
- squizlabs/php_codesniffer: ~2.0
- symfony/monolog-bundle: ~2.0
This package is auto-updated.
Last update: 2024-10-25 06:21:19 UTC
README
Api Bundle allows rapid setup of RESTful API to simplify Elasticsearch data access for the remote clients.
Documentation
The source of the documentation is stored in the Resources/doc/
folder in this bundle.
Read the API Bundle Documentation
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.
Step 1: Install
Api bundle is installed using Composer.
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
Step 3: Add configuration
Add minimal configuration for Api bundle to the config.yml
.
#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.
Add routing
#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.
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
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
License
This bundle is covered by the MIT license. Please see the complete license in the bundle LICENSE file.