定制 walidbtz7/laravel-intra-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

walidbtz7/laravel-intra-api

Composer 安装命令:

composer require walidbtz7/laravel-intra-api

包简介

A Laravel package to interact with the 42 Intra api

README 文档

README

Dependencies

  • PHP 8.1
  • Laravel 8.1

Features

  • Authentication through Intra
  • API calls through Intra

Installation

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
    ],
];

Usage

OAuth 2.0

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

API Calls

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();

统计信息

  • 总下载量: 34
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2022-08-11