pdd SDK for Laravel 6+ , 基于 observer/pdd
Laravel5
composer require "observer/laravel-pdd:~1.0"
- 在
config/app.php
注册 ServiceProvider 和 Facade (Laravel 5.5 + 无需手动注册)
'providers' => [
// ...
Observer\LaravelPdd\ServiceProvider::class,
],
'aliases' => [
// ...
'EasyPdd' => Observer\LaravelPdd\Facade::class,
],
- 创建配置文件:
php artisan vendor:publish --provider="Observer\LaravelPdd\ServiceProvider"
- 修改应用根目录下的
config/pdd.php
中对应的参数即可。
<?php
namespace App\Http\Controllers;
use EasyPdd\Foundation\Application;
class PddController extends Controller
{
public function demo(Application $pdd)
{
// $pdd 则为容器中 EasyPdd\Foundation\Application 的实例
}
}
EasyPdd::offsetGet('oauth');
MIT