Skip to content
This repository was archived by the owner on May 14, 2019. It is now read-only.

mops1k/api-bundle

Repository files navigation

mops1k/api-bundle

Symfony fast RESTful API generator by http://lakion.com/lionframe installation

Installation

php composer.phar require mops1k/api-bundle dev-master

Settings

add to app/AppKernel.php

    $bundles = array(
            // ...
            new FOS\RestBundle\FOSRestBundle(),
            new JMS\SerializerBundle\JMSSerializerBundle($this),
            new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),
            new Sylius\Bundle\TranslationBundle\SyliusTranslationBundle(),
            new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
            new Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(),
            new mops1k\ApiBundle\mops1kApiBundle(),
            // ...
        );

Import resource

#app/config/config.yml
imports:
    ...
    - { resource: '@mops1kApiBundle/Resources/config/api.yml' }

Create service

#app/config/config.yml
sylius_resource:
    resources:
        service.user: #service name
            driver: doctrine/orm
            classes:
                model: Entity #entity for api
                controller: Sylius\Bundle\ResourceBundle\Controller\ResourceController
                repository: Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository

Add routing

#@YourBundle/Resource/config/config.yml
amtelcom_users_rest_users:
    prefix: /api #required
    resource: service.user #service name
    type: sylius.api

Add dependency

#@YourBundle/DependencyInjection/YourBundleExtension.php
// ...
    public function load(array $configs, ContainerBuilder $container)
    {
        // ...

        $container->setParameter('sylius.locale', '%locale%');
        $container->setParameter('sylius.translation.mapping', array());

        // ...
    }
// ...

Enjoy it!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages