PHP code example of cristal / php-api-wrapper
1. Go to this page and download the library: Download cristal/php-api-wrapper 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/ */
cristal / php-api-wrapper example snippets
// Configure your API
use Cristal\ApiWrapper\Model;
use Cristal\ApiWrapper\Transports\Basic;
use App\User;
use Curl\Curl;
$transport = new Basic('username', 'password', 'http://api.example.com/v1/', new Curl);
$api = new Api($transport);
Model::setApi($api);
// Use your model like Eloquent (Usage with Symfony is significantly different)
$activedUsers = User::where(['active' => true])->get();
foreach($activedUsers as $user){
$user->active = false;
$user->save();
}