rackbeat / laravel-client
Laravel PHP Client Library for our API
dev-master
2024-11-19 23:04 UTC
Requires
- php: ^7.4|^8.1|^8.2|^8.3|^8.4
- ext-json: *
- guzzlehttp/guzzle: ^6.5|^7.0.1|^8.0
- laravel/framework: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
- nesbot/carbon: ^1.26.3 || ^2.0 || ^3.0
Requires (Dev)
- php-coveralls/php-coveralls: ^2.2
- phpunit/phpunit: ^7.5|^8.0|^9.0|^10.0
This package is auto-updated.
Last update: 2024-11-19 23:04:32 UTC
README
Installation
You just require using composer and you're good to go!
composer require rackbeat/laravel-client
Usage
Coming soon...
Testing
The API class comes with a handful of mocking tools. You can mock a response or just assert that endpoints has been called.
Assert calls has been made
// Set up the API class to use mocking \Rackbeat\API::mock(); // Has not been called yet \Rackbeat\API::assertNotCalled( 'get', '/lots' ); // Make a API call to GET /lots \Rackbeat\API::lots()->index(); // Has now been called \Rackbeat\API::assertCalled( 'get', '/lots' );
Mock the response
// Set up the API class to use mocking \Rackbeat\API::mock(); \Rackbeat\API::mockResponse('GET', '/lots', 'no lots'); // Make a API call to GET /lots \Rackbeat\API::lots()->index(); // Assert that the response was 'no lots' \Rackbeat\API::assertResponded( 'get', '/lots', 'no lots' );
Contributors
...
Requirements
- PHP >= 7.4
- Laravel >= 6.0