Download the PHP package webparking/logic4-client without Composer
On this page you can find all versions of the php package webparking/logic4-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webparking/logic4-client
More information about webparking/logic4-client
Files in webparking/logic4-client
Package logic4-client
Short Description A package to connect with Logic4
License MIT
Informations about the package logic4-client
Logic4 client
Please note that this API client is not created or maintained by Logic4. For questions about Logic4 or it's API please contact Logic4 support.
Installation
You can install the package via composer:
Configuration
In order to use the Logic4 API, you need to configure the AccessTokenManager
with your credentials. You can do this by calling the configure
method on the AccessTokenManager
instance.
The following configuration options are required
public_key
- The public key of your Logic4 accountcompany_key
- The company key of your Logic4 accountusername
- The username of your Logic4 accountsecret_key
- The secret key of your Logic4 accountpassword
- The password of your Logic4 accountadministration_id
- The administration id of your Logic4 account
The access token is automatically refreshed when it expires and stored in the cache. The cache object is set using the $cache
property on the AccessTokenManager
class and should implement the Psr\SimpleCache\CacheInterface
interface.
After configuring the AccessTokenManager
you can use any request class in your application without having to worry about the access token and other middleware.
Example configuration
Laravel integration
Integration with Laravel is easily done by configuring the AccessTokenManager
after it has been resolved by the Laravel IoC Container.
Add the following code to your AppServiceProvider
class:
This makes it possible to directly use any request class in your application without having to worry about the access token and other middleware.
Example request
Testing
You can test the package by running ./vendor/bin/phpunit
in the root of the project. Make sure install the dependencies by running composer install
before running the tests.
Preventing stray requests
If you would like to ensure that all requests sent via the client have been mocked throughout your individual test or complete test suite, you can call the preventStrayRequests
method on the \Webparking\Logic4Client\ClientFactory
class. After calling this method, any requests that do not have a corresponding mock will throw an exception rather than making the actual request:
Contributing
Please report any issue you find in the issues page. Pull requests are more than welcome.
Generating endpoints
The endpoints can automatically be generated using the generate
command. This command will generate a request class for each endpoint and a client class that can be used to instantiate the request classes.
License
The MIT License (MIT). Please see License File for more information.
All versions of logic4-client with dependencies
guzzlehttp/guzzle Version ^7.8
nesbot/carbon Version ^2.71
psr/simple-cache Version ^3.0