2017 © Pedro PelĂĄez
 

symfony-bundle employee

A bundle providing a RESTful API to handle Employees on BusinessBundle

image

aescarcha/employee

A bundle providing a RESTful API to handle Employees on BusinessBundle

  • Thursday, November 24, 2016
  • by aEscarcha
  • Repository
  • 1 Watchers
  • 1 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*1)

$ composer require aescarcha/employee "~1"

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*2)

Step 2: Install Requirements

composer require friendsofsymfony/rest-bundle
composer require jms/serializer-bundle
composer require nelmio/api-doc-bundle
composer require friendsofsymfony/user-bundle
composer require aescarcha/user-bundle dev-master
composer require league/fractal
composer require stof/doctrine-extensions-bundle
composer require aescarcha/business ~1

Step 3: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:, (*3)

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
            new FOS\RestBundle\FOSRestBundle(),
            new FOS\UserBundle\FOSUserBundle(),
            new JMS\SerializerBundle\JMSSerializerBundle(),
            new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
            new Aescarcha\UserBundle\AescarchaUserBundle(),
            new Aescarcha\BusinessBundle\AescarchaBusinessBundle(),
            new Aescarcha\EmployeeBundle\AescarchaEmployeeBundle(),
        );

        // ...
    }

    // ...
}

Step 4: Configure the Bundle

Enable the routes in app/config/routing.yml, (*4)

aescarcha_business:
    type: rest
    resource: "@AescarchaBusinessBundle/Resources/config/routing.yml"
    prefix:   /

aescarcha_employee:
    type: rest
    resource: "@AescarchaEmployeeBundle/Resources/config/routing.yml"
    prefix:   /

Configure the bundles in app/config/config.yml, (*5)

# app/config/config.yml
nelmio_api_doc: ~

fos_rest:
    routing_loader:
        default_format: json                            # All responses should be JSON formated
        include_format: false                           # We do not include format in request, so that all responses
                                                        # will eventually be JSON formated

body_listener:                                          # Decode full json bodies
    decoders:
         son: fos_rest.decoder.json


fos_user:
    db_driver: orm
    firewall_name: api                                  # Seems to be used when registering user/reseting password,
                                                        # but since there is no "login", as so it seems to be useless in
                                                        # our particular context, but still required by "FOSUserBundle"
    user_class: Aescarcha\UserBundle\Entity\User

Add this to app/config/security.yml, (*6)

security:
    encoders:
        FOS\UserBundle\Model\UserInterface: sha512

    providers:
        fos_userbundle:
            id: fos_user.user_provider.username        # fos_user.user_provider.username_email does not seem to work (OAuth-spec related ("username + password") ?)
    firewalls:
        oauth_token:                                   # Everyone can access the access token URL.
            pattern: ^/oauth/v2/token
            security: false
        api:
            pattern: ^/                                # All URLs are protected
            fos_oauth: true                            # OAuth2 protected resource
            stateless: true                            # Do no set session cookies
            anonymous: false                           # Anonymous access is not allowed

Add the following to app/config/routing.yml to be able to use the docs :, (*7)

# app/config/routing.yml
NelmioApiDocBundle:
    resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
    prefix:   /api/doc

Add to app/config/services.yml, (*8)

services: gedmo.listener.timestampable: class: Gedmo\Timestampable\TimestampableListener tags: - { name: doctrine.event_subscriber, connection: default } calls: - [ setAnnotationReader, [ "@annotation_reader" ] ], (*9)

Testing

To test this bundle, you need to download and enable the following bundles, (*10)

"doctrine/doctrine-fixtures-bundle": "^2.3",
"liip/functional-test-bundle": "^1.6"

$bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
$bundles[] = new Liip\FunctionalTestBundle\LiipFunctionalTestBundle();

And I recommend using this config in config_test.yml to use sqlite, (*11)

doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                driver:   pdo_sqlite
                path:     %kernel.cache_dir%/test.db

liip_functional_test:
    cache_sqlite_db: true

The Versions

24/11 2016

dev-master

9999999-dev

A bundle providing a RESTful API to handle Employees on BusinessBundle

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

by Álvaro Escarcha

symfony business employee

20/09 2016

dev-develop

dev-develop

A bundle providing a RESTful API to handle Employees on BusinessBundle

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

by Álvaro Escarcha

symfony business employee

20/09 2016

v1.0

1.0.0.0

A bundle providing a RESTful API to handle Employees on BusinessBundle

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

by Álvaro Escarcha

symfony business employee