Skip to content

soullivaneuh/CoopTilleulsOvhBundle

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 6 commits behind coopTilleuls:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

CoopTilleulsOVHBundle: OVH SDK integration in Symfony

This bundle integrates OVH's offical PHP SDK in the Symfony framework.

Build Status SensioLabsInsight Coverage Status

Installation

Use Composer to install the bundle:

composer require tilleuls/ovh-bundle

Then, update your app/config/AppKernel.php file:

    public function registerBundles()
    {
        $bundles = array(
            // ...
            new CoopTilleuls\OvhBundle\CoopTilleulsOvhBundle(),
            // ...
        );

        return $bundles;
    }

Configure the bundle in app/config/config.yml:

coop_tilleuls_ovh:
    endpoint_name:      "%ovh_endpoint_name%"
    application_key:    "%ovh_application_key%"
    application_secret: "%ovh_application_secret%"
    consumer_key:       "%ovh_consumer_key%"

Finally, update your app/config/parameters.yml file to store your OVH API credentials:

parameters:
    # ...
    ovh_endpoint_name:      "ovh-eu"
    ovh_application_key:    "MyOvhApplicationKey"
    ovh_application_secret: "MyOvhApplicationSecret"
    ovh_consumer_key:       "MyOvhConsumerKey"

Usage

The bundle automatically registers a ovh service in the Dependency Injection Container. That service is an instance of \Ovh\Api.

Example usage in a controller:

// ...

    public function smsAction()
    {
        // Send a SMS
        $this
            ->get('ovh')
            ->post(
                sprintf('/sms/%s/users/%s/jobs', 'my-service-name', 'my-login'),
                [
                    'message' => 'Si tu veux me parler, envoie-moi un... fax !',
                    'receivers' => ['+33612345678'],
                    'sender' => 'my-login',
                ]
            )
        ;

        // ...
    }

// ...
}

Credits

Created by Kévin Dunglas for Les-Tilleuls.coop.

About

OVH SDK integration in Symfony

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%