dev-master
9999999-devSymfony bundle for the Modlr REST ODM library.
Apache-2.0
The Requires
- php >=5.4
- symfony/framework-bundle >=2.0 <2.7 || ^3.0
- symfony/yaml >=2.0 <2.7 || ^3.0
- as3/modlr >=0.3.4 <1.0
by Jacob Bare
Wallogit.com
2017 © Pedro Peláez
Symfony bundle for the Modlr REST ODM library.
Integrates the modlr REST libraries with Symfony., (*2)
To utilize modlr, you must install a persister and an api specification., (*3)
To utilize search within modlr, you must install a search client., (*4)
Available modules can be found here, or you can write your own!, (*5)
To install this bundle with support for MongoDB, elasticsearch and the JSON Api Spec, add the following to your composer.json file:, (*6)
{
"require": {
"as3/modlr-bundle": "dev-master",
"as3/modlr-api-jsonapiorg": "dev-master",
"as3/modlr-search-elastic": "dev-master",
"as3/modlr-persister-mongodb": "dev-master"
}
}
Then, tell Composer to update and install the requested packages:, (*7)
composer update as3/modlr-bundle --with-dependencies
Once installed, register the bundle in your AppKernel.php:, (*8)
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new As3\Bundle\ModlrBundle\As3ModlrBundle(),
);
// ...
}
Modlr requires some configuration in order to work. You can use the default config below to get started:, (*9)
# app/config/config.yml
as3_modlr:
rest:
root_endpoint: /api
debug: "%kernel.debug%"
adapter:
type: jsonapiorg
persisters:
default:
type: mongodb
parameters:
host: mongodb://localhost:27017
search_clients:
default:
type: elastic
To utilize the external REST API, you must also include modlr's routing file. This will allow modlr to handle all requests to as3_modlr.rest.root_endpoint. To prevent any routing conflicts, you should add this before any other bundle or your application route definitions., (*10)
# app/config/routing.yml
as3_modlr_bundle:
resource: "@As3ModlrBundle/Resources/config/routing.yml"
Next you must define your models! By default, modlr's metadata driver will look for YAML files in app/Resources/As3ModlrBundle/models and app/Resources/As3ModlrBundle/mixins., (*11)
You can customize where your definitions are stored by setting the models_dir parameter of your metadata driver. See the bundle configuration documentation for more information., (*12)
See modlr documentation for additional information., (*13)
This bundle provides commands to rebuild modlr's metadatacache:, (*14)
app/console as3:modlr:metadata:cache:clear [model_type] [--no-warm]
Create collection schema:, (*15)
app/console as3:modlr:schema:create [model_type]
Symfony bundle for the Modlr REST ODM library.
Apache-2.0