Skip to content

Commit

Permalink
require easypdd package
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjingshou committed Jun 3, 2019
1 parent beecd35 commit ad1677a
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 7 deletions.
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# laravel-pdd

微信 SDK for Laravel 5 , 基于 [observer/pdd](https://github.com/Observer5/pdd)



## 框架要求

Laravel5

## 安装

```shell
composer require "overtrue/laravel-wechat:~1.0"
```

## 配置

### Laravel 应用

1.`config/app.php` 注册 ServiceProvider 和 Facade (Laravel 5.5 + 无需手动注册)

```php
'providers' => [
// ...
Observer\LaravelPdd\ServiceProvider::class,
],
'aliases' => [
// ...
'EasyPdd' => Observer\LaravelPdd\Facade::class,
],
```

2. 创建配置文件:

```shell
php artisan vendor:publish --provider="Observer\LaravelPdd\ServiceProvider"
```

3. 修改应用根目录下的 `config/pdd.php` 中对应的参数即可。


## License

MIT
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "observer/laravel-pdd",
"description": "pdd SDK for Laravel",
"require": {
"illuminate/container": "^5.1"
"illuminate/container": "^5.1",
"observer/pdd": "^1.0.0"
},
"license": "MIT",
"authors": [
Expand All @@ -22,7 +23,7 @@
"Observer\\LaravelPdd\\ServiceProvider"
],
"aliases": {
"EasyWeChat": "Observer\\LaravelPdd\\Facade"
"EasyPdd": "Observer\\LaravelPdd\\Facade"
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace Observer\LaravelPdd;

use EasyPdd\Foundation\Application;
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;


Expand All @@ -11,13 +12,18 @@ class ServiceProvider extends LaravelServiceProvider
*/
public function boot()
{

}

/**
* Register the provider.
*/
public function register()
{

$this->app->singleton(Application::class, function ($laravelApp) {
$app = new Application(config('pdd'));
return $app;
});

}
}
15 changes: 11 additions & 4 deletions src/config.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
<?php

return [
/*
* 默认配置,将会合并到各模块中
*/
'defaults' => [

'log' => [
'level' => env('PDD_LOG_LEVEL', 'debug'),
'file' => env('PDD_LOG_FILE', storage_path('logs/wechat.log')),
],

'client_id' => env('PDD_CLIENT_ID', 'your-client_id'), // ClientID
'client_secret' => env('PDD_CLIENT_SECRET', 'your-client_secret'), // ClientSecret

'oauth' => [
'callback' => env('PDD_OFFICIAL_ACCOUNT_OAUTH_CALLBACK', '/examples/oauth_callback.php'),
'member_type' => 'MERCHANT',
]
];

0 comments on commit ad1677a

Please sign in to comment.