Overview¶
Requirements¶
- PHP 5.3+
- composer
All composer dependencies are included in the Expressly provided integration releases on GitHub.
Include¶
Inside your composer.json, you need to include:
"require": {
"expressly/php-common": "1.1.6"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/expressly/php-common"
}
]
Configuration¶
All configuration values associated with the repository are contained within config.yml.
To act in development mode, the following block inside the config.yml should be changed from:
external:
hosts:
default: http://prod.expresslyapp.com/api/v1
admin: http://prod.expresslyapp.com/api/admin
to
external:
hosts:
default: http://dev.expresslyapp.com/api/v1
admin: http://dev.expresslyapp.com/api/admin
Create a Client¶
In order to make use of the DI container, to include, override, or extend any code we provide, a new instance of the Expressly Client is required.
use Expressly;
/*
* $merchantType is a string to help us identify your system type in logs.
* Example constants in: Expressly\Entity\MerchantType
*/
$client = new Client($merchantType, array());
$app = $client->getApp();
Checklist¶
For a working Expressly integration, using this library, the following need to be checked off:
- Include the project via composer (or alternative).
- Change Configuration if needed (for development purposes).
- Create a Client.
- Create a localized MerchantProvider: must extend MerchantProviderInterface, and register it with the application:
use Expressly\Provider\MerchantProviderInterface;
class MyMerchantProvider implements MerchantProviderInterface {
// your implementation
}
$app['merchant.provider'] = $app->share(function ($app) {
return new MyMerchantProvider();
});
[composer] | PHP package manager: https://getcomposer.org/ |
[config.yml] | src/Resources/config/config.yml |
[Silex] | Silex PHP Microframework: http://silex.sensiolabs.org/ |
[Pimple] | DI implementation: http://pimple.sensiolabs.org/ |
[DI] | Dependency Injection |
[MerchantProviderInterface] | src/Provider/MerchantProviderInterface.php (ExpresslyProviderMerchantProviderInterface) |