ifaniqbal / api-its-laravel
API ITS client for Laravel
0.1.2
2020-12-04 05:58 UTC
Requires
- php: ^7.2
- guzzlehttp/guzzle: ~6.0
- illuminate/support: 5.1.* || 5.5.* || ^6
README
The purpose of this package is to consume API ITS. This package should be compatible with Laravel 5.1, 5.5, and 6.x.
Installation
composer require ifaniqbal/api-its-laravel
If using Laravel 5.1, include the service provider within config/app.php
.
'providers' => [ 'Ifaniqbal\ApiIts\ApiItsServiceProvider', ];
Add a facade alias to this same file at the bottom:
'aliases' => [ 'ApiIts' => 'Ifaniqbal\ApiIts\Facades\ApiIts', ];
Configuration
These are list of .env
keys that can be configured:
API_ITS_TOKEN_URL= # access token (client_credentials) token URL, default: https://my.its.ac.id/token API_ITS_CLIENT_ID= # client ID API_ITS_CLIENT_SECRET= # client secret
For example, if most of the values you need is same as default values, configure only these values within your .env
file:
API_ITS_CLIENT_ID= API_ITS_CLIENT_SECRET=
Usage
<?php namespace App\Http\Controllers; use App\Mahasiswa; use Ifaniqbal\ApiIts\Facades\ApiIts; class MahasiswaController extends Controller { public function show($id) { $mahasiswa = Mahasiswa::find($id); $frsKuliah = ApiIts::username($mahasiswa->username) ->mahasiswaFrsKuliah(); } }