A Laravel package to interact with the 42 Intra api
walidbtz7/laravel-intra-api is a Laravel package for a laravel package to interact with the 42 intra api .
It currently has 0 GitHub stars and 34 downloads on Packagist.
Install it with composer require walidbtz7/laravel-intra-api.
Discover more Laravel packages by walidbtz7
or browse all Laravel packages to compare alternatives.
Last updated
Step 1. Install the package
composer require Walidbtz7/laravel-intra-api
Step 2. Add ServiceProvider
in config/app.php
return [
// ...
'providers' => [
/*
* Package Service Providers...
*/
Walidbtz7\IntraApi\IntraServiceProvider::class,
]
];
Step 3. Add services
in config/services.php
return [
// ...
'intra' => [
'url' => env('42_URL'), // The main API url
'client_id' => env('42_CLIENT_ID'), // The client_id
'client_secret' => env('42_CLIENT_SECRET'), // The client_secret
],
];
Step 1. Authentication url
use Walidbtz7\IntraApi\Facades\IntraOAuth;
IntraOAuth::driver('intra')->buildAuthUrl()
Step 2. Callback
use Walidbtz7\IntraApi\Facades\IntraOAuth;
$response = IntraOAuth::driver('intra')->token(); // makes the token call
$user = $response->user(); // returns the OAuth user
use Walidbtz7\IntraApi\Facades\IntraAPI;
$headers = [
'Authorization' => 'Bearer ' . $access_token,
];
$response = IntraAPI::driver('intra')->setEndpoint("/v2/me/teams")->with(['page' => '1'])->headers($headers)->get();
return $response->getBody();