File tree Expand file tree Collapse file tree 3 files changed +37
-5
lines changed Expand file tree Collapse file tree 3 files changed +37
-5
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ Laravel5
1111## 安装
1212
1313``` shell
14- composer require " overtrue /laravel-wechat :~1.0"
14+ composer require " observer /laravel-pdd :~1.0"
1515```
1616
1717## 配置
@@ -40,6 +40,36 @@ php artisan vendor:publish --provider="Observer\LaravelPdd\ServiceProvider"
40403 . 修改应用根目录下的 ` config/pdd.php ` 中对应的参数即可。
4141
4242
43+ ## 使用
44+
45+ ### 我们有以下方式获取 SDK 的服务实例
46+
47+ #### 使用容器的自动注入
48+
49+ ``` php
50+ <?php
51+
52+ namespace App\Http\Controllers;
53+
54+ use EasyPdd\Foundation\Application;
55+
56+ class PddController extends Controller
57+ {
58+
59+ public function demo(Application $pdd)
60+ {
61+ // $pdd 则为容器中 EasyPdd\Foundation\Application 的实例
62+ }
63+ }
64+ ```
65+
66+ #### 使用外观
67+
68+ ``` php
69+ EasyPdd::oauth;
70+
71+ ```
72+
4373## License
4474
4575MIT
Original file line number Diff line number Diff line change 11<?php
22namespace Observer \LaravelPdd ;
33
4- use EasyPdd \Foundation \Application ;
4+ use EasyPdd \Foundation \Application as Pdd ;
55use Illuminate \Foundation \Application as LaravelApplication ;
66use Illuminate \Support \ServiceProvider as LaravelServiceProvider ;
77
@@ -27,10 +27,12 @@ public function boot()
2727 */
2828 public function register ()
2929 {
30- $ this ->app ->singleton (' easy.pdd ' , function ($ laravelApp ) {
31- $ app = new Application (config ('pdd ' ));
30+ $ this ->app ->singleton (Pdd::class , function ($ laravelApp ) {
31+ $ app = new Pdd (config ('pdd ' ));
3232 return $ app ;
3333 });
3434
35+ $ this ->app ->alias (Pdd::class, 'pdd ' );
36+ $ this ->app ->alias (Pdd::class, 'easypdd ' );
3537 }
3638}
Original file line number Diff line number Diff line change 44
55 'log ' => [
66 'level ' => env ('PDD_LOG_LEVEL ' , 'debug ' ),
7- 'file ' => env ('PDD_LOG_FILE ' , storage_path ('logs/wechat .log ' )),
7+ 'file ' => env ('PDD_LOG_FILE ' , storage_path ('logs/pdd .log ' )),
88 ],
99
1010 'client_id ' => env ('PDD_CLIENT_ID ' , 'your-client_id ' ), // ClientID
You can’t perform that action at this time.
0 commit comments