2017 © Pedro Peláez
 

symfony-bundle ovh-sms-bundle

OVH SDK integration

image

wlmaroc/ovh-sms-bundle

OVH SDK integration

  • Monday, June 5, 2017
  • by wlmaroc
  • Repository
  • 0 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

WlmarocOVHBundle: OVH SDK integration in Symfony

This bundle integrates OVH's offical PHP SDK in the Symfony framework., (*1)

Installation

Use Composer to install the bundle:, (*2)

composer require wlmaroc/ovh-sms-bundle, (*3)

Then, update your app/config/AppKernel.php file:, (*4)

    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Wlmaroc\OvhSmsBundle\WlmarocOvhSmsBundle(),
            // ...
        );

        return $bundles;
    }

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

wlmaroc_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:, (*6)

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., (*7)

Example usage in a controller:, (*8)

// ...

    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 [Web Logiciel Maroc] (http://wlmaroc.com)., (*9)

The Versions