PHP code example of macropay-solutions / php-crufd-wizard-client
1. Go to this page and download the library: Download macropay-solutions/php-crufd-wizard-client 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/ */
macropay-solutions / php-crufd-wizard-client example snippets
$crud = new \MacropaySolutions\CrufdWizardClient\RequestBuilder(\env('API_BEARER'), \env('APP_URL'));
try {
$result = $crud->list('clients', $crud->getBuilder()->sort('country', 'asc')
->sort('zip')->equals('name', 'alt')->withRelation('relation')
->withRelations(['rel1', 'rel2'])
->addCountRelations(['relation1'])->addExistRelation('relation2');
$result = $crud->get('clients', '73', ['rel1', 'rel2']);
$result = $crud->delete('clients', '73');
$result = $crud->create('clients', [
'active' => '1',
'name' => 'abc',
// ...
]);
$result = $crud->update('clients', '73', [
'active' => '1',
'name' => 'abc',
// ...
]);
} catch (\Exception $e) {
$decodedErrorMessage = \json_decode($e->getMessage());
echo $decodedErrorMessage->message;
}
$decodedResult = \json_decode($result);