as3 / modlr-bundle
Symfony bundle for the Modlr REST ODM library.
Installs: 16 864
Dependents: 2
Suggesters: 0
Security: 0
Stars: 2
Watchers: 4
Forks: 1
Open Issues: 1
Requires
- php: >=5.4
- as3/modlr: >=0.3.4 <1.0
- symfony/framework-bundle: >=2.0 <2.7 || ^3.0
- symfony/yaml: >=2.0 <2.7 || ^3.0
This package is not auto-updated.
Last update: 2024-11-09 19:58:02 UTC
README
Integrates the modlr REST libraries with Symfony.
Installation
To utilize modlr, you must install a persister and an api specification.
To utilize search within modlr, you must install a search client.
Available modules can be found here, or you can write your own!
Install packages with Composer
To install this bundle with support for MongoDB, elasticsearch and the JSON Api Spec, add the following to your composer.json file:
{
"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:
composer update as3/modlr-bundle --with-dependencies
Register the Bundle
Once installed, register the bundle in your AppKernel.php
:
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new As3\Bundle\ModlrBundle\As3ModlrBundle(),
);
// ...
}
Configuration
Modlr requires some configuration in order to work. You can use the default config below to get started:
# 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.
# 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
.
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.
Usage
See modlr documentation for additional information.
This bundle provides commands to rebuild modlr's metadatacache:
app/console as3:modlr:metadata:cache:clear [model_type] [--no-warm]
Create collection schema:
app/console as3:modlr:schema:create [model_type]