1. Go to this page and download the library: Download lee/service-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lee / service-bundle example snippets
$config = [
'service-name' => 'Mailgun',
//e.g. key-98dXXXXXXX
'api-key' => 'mailgun-api-key',
//e.g. sandbox5099cXXXXXXXXXXXXXXXXXXX
'domain-name' => 'mailgun-domain-name',
'from' => '[email protected]',
'to' => '[email protected]',
'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());
$config = [
'api-key' => 'sendgrid-api-key',
'from-name' => 'John Doe',
'from-email' => '[email protected]',
'to-name' => 'John Doe',
'to-email' => '[email protected]',
'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());
$config = [
'api-key-public' => 'mailjet-public-api-key',
'api-key-private' => 'mailjet-privave-api-key',
'from-name' => 'John Doe',
'from-email' => '[email protected]',
'to-name' => 'John Doe',
'to-email' => '[email protected]',
'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());
$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());
$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());
$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());
$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());