2017 © Pedro Peláez
 

api service-bundle

Intergated with mailing service,uploading image service and so on.

image

lee/service-bundle

Intergated with mailing service,uploading image service and so on.

  • Thursday, January 18, 2018
  • by peter279k
  • Repository
  • 1 Watchers
  • 7 Stars
  • 29 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 4 Open issues
  • 19 Versions
  • 0 % Grown

The README.md

serviceBundle

Build Status Latest Stable Version Total Downloads Latest Unstable Version License codecov Gitter, (*1)

SensioLabsInsight, (*2)

Integrating with mailing service, uploading image service and so on., (*3)

It's based on Guzzle,HTTP client., (*4)

Following service table is about supporting status

service-name support service-type
mailgun Yes mailing service
mailjet No mailing service
sendgrid Yes mailing service
Imgur Yes uploading images service
Imageshack Yes uploading images service
bit.ly Yes shorten url service
McAf.ee Yes shorten url service

Usage

Install Package

We strongly recommended using composer, (*5)

Getting composer bash curl -sS https://getcomposer.org/installer | php Using this command bash php composer.phar require lee/service-bundle, (*6)

Sample code

Mailgun: a sending mail service php require 'vendor/autoload.php'; $config = [ 'service-name' => 'Mailgun', //e.g. key-98dXXXXXXX 'api-key' => 'mailgun-api-key', //e.g. sandbox5099cXXXXXXXXXXXXXXXXXXX 'domain-name' => 'mailgun-domain-name', 'from' => 'peter279k@gmail.com', 'to' => 'peter279k@gmail.com', 'subject' => 'Hello', //contents supported only plain text now. 'contents' => 'Mailgun is awesome !' ]; $bundle = new \peter\components\serviceBundle\ServiceBundle($config); //return json format (mailgun standard api response via cURL) var_dump($bundle->sendReq()); SendGrid: a sending mail service php require 'vendor/autoload.php'; $config = [ 'api-key' => 'sendgrid-api-key', 'from-name' => 'John Doe', 'from-email' => 'john.doe@gmail.com', 'to-name' => 'John Doe', 'to-email' => 'john.doe@gmail.com', 'subject' => 'SendGrid Test', 'contents' => 'Sendgrid is awesome!', ]; $service = (new peter\components\serviceBundle\Services\ServiceFactory)->create('SendGrid'); $service->setConfig($config); //return json format (SendGrid standard api response via cURL) var_dump($service->sendReq()); Mailjet: a sending mail service php require 'vendor/autoload.php'; $config = [ 'api-key-public' => 'mailjet-public-api-key', 'api-key-private' => 'mailjet-privave-api-key', 'from-name' => 'John Doe', 'from-email' => 'john.doe@gmail.com', 'to-name' => 'John Doe', 'to-email' => 'john.doe@gmail.com', 'subject' => 'Mailjet Test', 'contents' => 'Mailjet is awesome!', ]; $service = (new peter\components\serviceBundle\Services\ServiceFactory)->create('Mailjet'); $service->setConfig($config); //return json format (Mailjet standard api response via cURL) var_dump($service->sendReq()); Imgur: an uploading images service php require 'vendor/autoload.php'; $config = [ 'service-name' => 'Imgur', 'clientID' => 'imgur-client-id', 'filePath' => '/path/to/image.png' ]; $bundle = new \peter\components\serviceBundle\ServiceBundle($config); //return json format (Imgur standard api response via cURL) var_dump($bundle -> sendReq());, (*7)

ImageShack: an uploading images service php require 'vendor/autoload.php'; $config = [ 'service-name' => 'ImageShack', 'key' => 'your-Imageshack-api-key', //specify the image max file size 'maxFileSize' => '5242880' 'filePath' => '/path/to/image.png' ]; $bundle = new \peter\components\serviceBundle\ServiceBundle($config); //return json format (Imgur standard api response via cURL) var_dump($bundle -> sendReq());, (*8)

McAfee: a shorten url service php require 'vendor/autoload.php'; $config = [ 'service-name' => 'McAfee', 'longUrl' => 'your-long-url' ]; $bundle = new \peter\components\serviceBundle\ServiceBundle($config); //return json format (McAf standard api response via cURL) var_dump($bundle->sendReq()); Bitly: a shorten url service php require 'vendor/autoload.php'; $config = [ 'service-name' => 'Bitly', 'login' => 'your-login', 'apiKey' => 'your-api-key', 'longUrl' => 'your-long-url' ]; $bundle = new \peter\components\serviceBundle\ServiceBundle($config); //return json format (bit.ly standard api response via cURL) var_dump($bundle -> sendReq());, (*9)

Run TestCase

composer test, (*10)

Changelog

2016/07/20

  • version: v1.2.7
  • Using the new version of Guzzle 5 and avoid the Httpoxy vulnerability.

2016/07/21

  • version: v1.2.8
  • Fix the uploading image via imgur service bug.

2016/07/21

  • version: v1.2.9
  • adding some information images

2016/07/21

  • version: v1.3.1
  • supporting the Imageshack API

2017/11/11

  • version: v1.4.0
  • Change the namespace and see the sample code to know this.
  • Change the source code(code refactoring)
  • Using the PHPUnit Mock to test the HTTP API requests.
  • The version 2.x is deprecated.
  • Update the Guzzle version to 6.2
  • Change the service-name value in $config array.

Version Guidance

Version Status Packagist Namespace PSR-7
1.x Maintained lee/service-bundle peter\components\serviceBundle No
2.x **Deprecated lee/service-bundle peter\components\ServiceBundle No

serviceBundle-1-repo, (*11)

serviceBundle-2-repo(deprecated), (*12)

The Versions

18/01 2018

dev-master

9999999-dev

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar peter279k

18/01 2018

v1.4.0

1.4.0.0

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar peter279k

12/11 2017

dev-guzzle6

dev-guzzle6

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

by Avatar peter279k

13/08 2016

v2.0.0

2.0.0.0

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

by Avatar peter279k

12/08 2016

v1.3.1

1.3.1.0

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

by Avatar peter279k

09/08 2016

v1.3.0

1.3.0.0

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar peter279k

20/07 2016

v1.2.9

1.2.9.0

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar peter279k

20/07 2016

v1.2.8

1.2.8.0

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar peter279k

20/07 2016

v1.2.7

1.2.7.0

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar peter279k

31/01 2016

v1.2.6

1.2.6.0

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar peter279k

31/01 2016

v1.2.4

1.2.4.0

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar peter279k

31/01 2016

v1.2.3

1.2.3.0

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar peter279k

31/01 2016

v1.2.1

1.2.1.0

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar peter279k

31/01 2016

v1.2.0

1.2.0.0

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar peter279k

31/01 2016

v1.0.3

1.0.3.0

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar peter279k

31/01 2016

v1.0.4

1.0.4.0

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar peter279k

31/01 2016

v1.0.2

1.0.2.0

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar peter279k

30/01 2016

v1.0.1

1.0.1.0

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar peter279k

29/01 2016

v1.0

1.0.0.0

Intergated with mailing service,uploading image service and so on.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar peter279k