1. Go to this page and download the library: Download peter9x/laravel-provet-api 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/ */
use Mupy\ProvetApi\Facades\Provet;
use Mupy\ProvetApi\Paths\Client;
use Mupy\ProvetApi\Paths\Query;
use Mupy\ProvetApi\Enums\Operator;
// Retrieve
$client = Provet::get(Client::get(42));
// List, with filters, ordering and pagination
$query = (new Query())
->where('email', Operator::ICONTAINS, 'acme')
->orderByDesc('created')
->perPage(50);
$clients = Provet::get(Client::all($query));
// Create / update / delete (only exposed on resources the API actually supports)
Provet::post(Client::create(), ['firstname' => 'Ada']);
Provet::patch(Client::update(42), ['firstname' => 'Ada Lovelace']);
Provet::delete(Client::delete(42));
use Mupy\ProvetApi\ProvetClient;
use Mupy\ProvetApi\Paths\Client;
class SyncClientsController
{
public function __construct(
private readonly ProvetClient $provet,
) {}
public function __invoke(int $id)
{
// Pass a connection name to use a tenant other than the default one.
return $this->provet->connection('2449')->get(Client::get($id));
}
}
Provet::connection('2449')->get(Client::all());
use Mupy\ProvetApi\Paths\Invoice;
foreach (Provet::paginate(Invoice::all()) as $invoice) {
// one invoice at a time, no buffering
}
// Or with a stop condition and progress tracking:
Provet::paginate(Invoice::all())
->onPageEnd(fn ($page) => logger()->info("page done, next: {$page->next}"))
->each(function ($invoice) {
// return false to stop early
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.