2017 © Pedro Peláez
 

symfony-bundle api-server-bundle

DaApiServerBundle is a Symfony2's bundle allowing to provide a REST API in a simple and secure way

image

da/api-server-bundle

DaApiServerBundle is a Symfony2's bundle allowing to provide a REST API in a simple and secure way

  • Wednesday, November 26, 2014
  • by Gnucki
  • Repository
  • 4 Watchers
  • 3 Stars
  • 36,736 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 5 % Grown

The README.md

DaApiServerBundle

DaApiServerBundle is a Symfony2's bundle allowing to provide a REST API in a simple and secure way., (*1)

Installation

Installation is a quick 2 steps process., (*2)

Step 1: Add in composer

Add the bundle in the composer.json file:, (*3)

``` js // composer.json, (*4)

"require": { // ... "da/auth-common-bundle": "dev-master", "da/api-server-bundle": "dev-master" },, (*5)


And update your vendors: ``` bash composer update # WIN composer.phar update # LINUX

Step 2: Declare in the kernel

Declare the bundle in your kernel:, (*6)

``` php // app/AppKernel.php, (*7)

$bundles = array( // ... new Da\AuthCommonBundle\DaAuthCommonBundle(), new Da\ApiServerBundle\DaApiServerBundle(), );, (*8)


Check the client API key ------------------------ If you want to check the API token of a client of your API for a route pattern, you must specify it in your security.yml: ``` yaml # app/config/security.yml security: firewalls: #... api: pattern: ^/api da_api: true stateless: true

The URLs under /api will authenticate a client of your API with the API token send with the request. For the time being, the API token must be send in the HTTP header "X-API-Security-Token"., (*9)

Check a given oauth token

If you want to check an oauth token given in the Authorization header of the request (Bearer token), you can specify it like this:, (*10)

``` yaml, (*11)

app/config/security.yml

security: firewalls: #..., (*12)

    api_user:
        pattern:   ^/api/user
        da_oauth:  true
        stateless: true

Remote checking --------------- If your API is not at the same place as your SSO server (with oauth, ...), just follow these step: Add the bundle in the composer.json file: ``` js // composer.json "require": { // ... "da/api-client-bundle": "dev-master" },

And update your vendors:, (*13)

``` bash composer update # WIN composer.phar update # LINUX, (*14)


Then, set the config: ``` yaml # app/config/config.yml # DaApiClient Configuration da_api_client: api: sso_user: endpoint_root: %api.sso.endpoint_root% security_token: %api.sso.security_token% client: service: da_api_server.user_manager.http sso_client: endpoint_root: %api.sso.endpoint_root% security_token: %api.sso.security_token% client: service: da_api_server.client_manager.http # DaApiServer Configuration da_api_server: user_manager: da_api_client.api.sso_user client_manager: da_api_client.api.sso_client

Finally, set the corresponding parameters:, (*15)

``` yaml, (*16)

app/config/parameters.yml and app/config/parameters.yml.dist

parameters: # ... api.sso.endpoint_root: 'http://my-domain.com/api' api.sso.security_token: 3jgwm1izbse884cwskk00c0o4ww8kg08gsgc4o808gsssw4 ```, (*17)

Documentation

This bundle have some other features that can help you to develop a REST API documented here., (*18)

What about the API client side?

Take a look at the DaApiClientBundle!, (*19)

The Versions

26/11 2014

1.0.x-dev

1.0.9999999.9999999-dev https://github.com/Gnuckorg/DaApiServerBundle

DaApiServerBundle is a Symfony2's bundle allowing to provide a REST API in a simple and secure way

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Prelot

api bundle server symfony da

26/11 2014

v1.0.2

1.0.2.0 https://github.com/Gnuckorg/DaApiServerBundle

DaApiServerBundle is a Symfony2's bundle allowing to provide a REST API in a simple and secure way

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Prelot

api bundle server symfony da

26/11 2014

dev-master

9999999-dev https://github.com/Gnuckorg/DaApiServerBundle

DaApiServerBundle is a Symfony2's bundle allowing to provide a REST API in a simple and secure way

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Prelot

api bundle server symfony da

11/07 2014

v1.0.1

1.0.1.0 https://github.com/Gnuckorg/DaApiServerBundle

DaApiServerBundle is a Symfony2's bundle allowing to provide a REST API in a simple and secure way

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Prelot

api bundle server symfony da

25/06 2014

v1.0.0

1.0.0.0 https://github.com/Gnuckorg/DaApiServerBundle

DaApiServerBundle is a Symfony2's bundle allowing to provide a REST API in a simple and secure way

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Prelot

api bundle server symfony da