anper / jsonbox
This package is abandoned and no longer maintained.
No replacement package was suggested.
PHP wrapper for https://jsonbox.io
v0.6.0
2021-01-07 15:36 UTC
Requires
- php: ^7.1||^8.0
- ext-json: *
- guzzlehttp/guzzle: ^6.2||^7.0
- psr/http-message: ~1.0
Requires (Dev)
- phpstan/phpstan: ^0.12.65
- phpunit/phpunit: ^7.0||^8.0||9.0
- squizlabs/php_codesniffer: ^3.0
README
PHP wrapper / Client SDK for jsonbox
Install
$ composer require anper/jsonbox
Usage
use Anper\Jsonbox\Jsonbox; $jsonbox = Jsonbox::factory('box-id');
Create
// Create a record $response = $jsonbox->create(['name' => 'Arya Stark']); // Create multiple records $response = $jsonbox->create([ ['name' => 'Daenerys Targaryen'], ['name' => 'Arya Stark'], ]); // Create a collection $response = $jsonbox->colletion('users') ->create(/* like one record or multiple records */);
Read
// Read a record $response = $jsonbox->record('5d776a25fd6d3d6cb1d45c51')->read(); // Read a collection $response = $jsonbox->collection('users')->read(); // Read all $response = $jsonbox->read();
Filtering
$filter = new \Anper\Jsonbox\Filter(); $filter->equalTo('name', 'Arya Stark'); // Filter all $response = $jsonbox->read($filter); // Filter collection $response = $jsonbox->collection('users')->read($filter);
Update
// Update a record $response = $jsonbox->record('5d776a25fd6d3d6cb1d45c51') ->update(['name' => 'Arya Stark']); // Update multiple records (async request for every record) $response = $jsonbox->update([ '5d776b75fd6d3d6cb1d45c52' => ['name' => 'Daenerys Targaryen'], '5d776b75fd6d3d6cb1d45c53' => ['name' => 'Arya Stark'], ]);
Delete
// Delete a record $response = $jsonbox->record('5d776a25fd6d3d6cb1d45c51')->delete(); // Delete multiple records (async request for every record) $response = $jsonbox->delete([ '5d776b75fd6d3d6cb1d45c52', '5d776b75fd6d3d6cb1d45c53', ]); // Delete by filter $response = $jsonbox->delete($filter);
Protected Box
// An API-KEY should be a valid GUID/UUID $protectedJsonbox = $jsonbox->withApiKey('API_KEY');
Test
$ composer test
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.