dataexchangeedu / laravel-data-api-sifuk20
A Laravel wrapper for dataexchangeedu/php-api-sifuk20
This package's canonical repository appears to be gone and the package has been frozen as a result.
Requires
- php: >=5.6.4
- dataexchangeedu/php-data-api-sifuk20: ^2.3
- laravel/framework: 5.*
Requires (Dev)
- phpunit/phpunit: ~5.5
This package is not auto-updated.
Last update: 2024-01-20 22:45:15 UTC
README
DataExchangeApi provides a simple Laravel wrapper (facade) around the dataexchangeedu/php-data-api-sifuk20 library for use against DataExchange (dataexchange.education).
Quick Installation
-
Install the package through Composer.
composer require dataexchangeedu/laravel-data-api-sifuk20
-
Add the service provider to your project's
config/app.php
file.'providers' => [ ... DataExchange\Laravel\SIFUK20\DataExchangeApiServiceProvider::class, ... ],
-
Add the Facade to your project
config/app.php
file.'aliases' => [ ... 'DataExchangeApi' => DataExchange\Laravel\SIFUK20\Facades\DataExchangeApi::class, ... ],
-
Publish the configuration, models, and migrations into your project.
php artisan vendor:publish --provider="DataExchange\Laravel\SIFUK20\DataExchangeApiServiceProvider"
-
Set your connection settings in
config\dataexchange-data-api.php
. -
Start using it!
<?php use DataExchangeApi; use Exception; ... try { dd(DataExchangeApi::on('default')->getSchoolInfos()); } catch (Exception $ex) { dd($ex); } ...
Different ways to call the same thing (assuming
ZONEID
is in connectionschool
, which is the default connection):DataExchangeApi::getSchoolInfos(); // Implicitly use the default connection
DataExchangeApi::on(null)->getSchoolInfos(); // Implicitly use the default connection
DataExchangeApi::on('default')->getSchoolInfos(); // Explicitly use the default connection
DataExchangeApi::on('school')->getSchoolInfos(); // Explicitly use the school connection
DataExchangeApi::getApiInstance()->getSchoolInfos('ZONEID'); // Talk directly using the wrapped API
Debugging
If you need to see a bit more of what the underlying API is doing add the following code to an appropriate place in DataExchange\SIFUK20\ApiClient@callApi
. This will enable you to use Fiddler on your host machine and see what the messages look like:
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, 1); curl_setopt($curl, CURLOPT_PROXY, 'http://10.0.2.2:8888');
Or if it's guzzle based add the following to the send calls:
[ 'proxy' => [ 'http' => 'http://10.0.2.2:8888', 'https' => 'https://10.0.2.2:8888', ], 'verify' => false, ]