Download the PHP package trialog/p4s-api-bundle without Composer

On this page you can find all versions of the php package trialog/p4s-api-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package p4s-api-bundle

AMISURE - P4S API

Latest Stable Version

La plateforme P4S du projet de recherche français AMISURE (http://www.amisure.fr) offre une API REST. Cette bibliothèque fournit un bundle Symfony2 permettant une intégration facilitée avec cette API. Plus besoin de se soucier de l'API REST bas niveau, il est possible de manipuler directement des objets PHP.

Features

Installation & Usage

Add this library to your Symfony2 project using your Composer file. You need to add the following dependencies:

"require" : {
    "php" : ">=5.3.3",
    "hwi/oauth-bundle" : "dev-master",
    "trialog/p4s-api-bundle" : "dev-master",
    "zumba/json-serializer" : "dev-master"
}

Normally, only "trialog/p4s-api-bundle" should be required, but a known bug prevents us to use this alone.

Then, you need to add this library as a bundle to app/AppKernel.php:

public function registerBundles()
{
    $bundles = array(
        // ...
        new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),
        new Amisure\P4SApiBundle\AmisureP4SApiBundle()

You can then use the p4s.accessor service in your code, for exemple in a Controller to retrieve a list of Organisations:

$this->get('p4s.accessor')->findOrganizations(array(
    'organizationType' => UserConstants::SAAD,
    'departementCode' => '94'
));

_If you don't want to use this bundle to manage the OAuth authentication, you can by-pass the following steps. But you need to provide the OAuth "access_token" as a session variable: $this->session->get('accesstoken').

To enable the OAuth authentification system, you need to configure this library in your config.yml file:

# HWIOAuth
hwi_oauth:
    firewall_name: oauth_secured_area
    http_client:
        timeout:       5 # Time in seconds, after library will shutdown request, by default: 5
        verify_peer:   false # Setting allowing you to turn off SSL verification, by default: true
        ignore_errors: true # Setting allowing you to easier debug request errors, by default: true
        max_redirects: 5 # Number of HTTP redirection request after which library will shutdown request,
                         # by default: 5
    resource_owners:
        p4s.login:
            type:                oauth2
            client_id:           123456abcdef
            client_secret:       apppass1
            access_token_url:    %p4s_path%api/token
            authorization_url:   %p4s_path%api/login
            infos_url:           %p4s_path%api/profile
            scope:               "read"
            user_response_class: HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse
            paths:
                identifier: id
                nickname:   username
                realname:   fullname

The parameter %p4s_path% can be defined defined in parameters.yml and should contain the P4S URL: http://p4s.trialog.com.

You should also configure your firewall in security.tml

security:
    encoders:
        Amisure\P4SApiBundle\Entity\User\SessionUser:
            algorithm:   sha1
            iterations: 1
            encode_as_base64: false

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER, ROLE_BENEFICIARY, ROLE_ORG_USER, ROLE_ORG_ADMIN_USER
        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH, BENEFICIARY, ROLE_ORG_USER, ROLE_ORG_ADMIN_USER]

    providers:
        chain_provider:
            chain:
                providers: [user_db]
        user_db:
            entity: { class: Amisure\P4SApiBundle\Entity\User\SessionUser, property: username }
        my_custom_hwi_provider:
            id: ib_user.oauth_user_provider

    firewalls:
        oauth_secured_area:
            anonymous: true
            logout: ~
            oauth:
                resource_owners:
                    p4s.login: "/oauth/login/check-p4s"
                login_path: /home
                check_path: /oauth/login
                failure_path: /oauth/login
                oauth_user_provider:
                    service: ib_user.oauth_user_provider

    access_control:
        - { path: ^/home, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/aide, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/oauth/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/oauth/connect, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/, roles: IS_AUTHENTICATED_FULLY }

Then, you need to complete your routs in your routing.yml file:

login_p4s:
    pattern: /oauth/login/check-p4s
logout:
    pattern:   /logout

Work in progress

Current tasks

Known bugs

Si aucune activité n'a eu lieu avec le P4S durant 1h, alors toutes tentatives de connexion du service ou d'appel au P4S (si l'utilisateur est déjà connecté au service) sont vouées à l'échec. La solution consiste à manuellement se déconnecter du P4S (bouton "Déconnexion" en haut à droite sur l'IHM du P4S), puis de reconnecter le service au P4S (bouton "Se connecter via le P4S" sur l'IHM du service)

License

This software is the property of TRIALOG (http://www.trialog.com).


All versions of p4s-api-bundle with dependencies

PHP Build Version
Package Version
Requires symfony/symfony Version 2.3.*
doctrine/doctrine-fixtures-bundle Version dev-master
doctrine/orm Version >=2.2.3,<2.4-dev
symfony/assetic-bundle Version 2.3.*
guzzle/guzzle Version ~3.7
twig/extensions Version 1.0.*
hwi/oauth-bundle Version dev-master
misd/guzzle-bundle Version ~1.0
php Version >=5.3.3
sensio/generator-bundle Version 2.3.*
symfony/monolog-bundle Version 2.3.*
sensio/framework-extra-bundle Version 2.3.*
doctrine/doctrine-bundle Version 1.2.*
sensio/distribution-bundle Version 2.3.*
zumba/json-serializer Version dev-master
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package trialog/p4s-api-bundle contains the following files

Loading the files please wait ....