Skip to content

Commit d34fff0

Browse files
committed
优化文档,并更新至 2.0 版本
1 parent 6bb887a commit d34fff0

File tree

7 files changed

+140
-40
lines changed

7 files changed

+140
-40
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 陈恺垣
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,71 @@
1-
# laravel-dingtalk
1+
<h1 align="center"> laravel-dingtalk </h1>
22

3-
钉钉 SDK for Laravel 5 / Lumen, 基于 [mingyoung/dingtalk](https://github.com/mingyoung/dingtalk)
3+
<p align="center"> 钉钉 SDK Laravel/Lumen 扩展包 </p>
44

5-
## 框架要求
5+
<p align="center">
6+
<a href="https://packagist.org/packages/calchen/laravel-dingtalk">
7+
<img alt="Latest Stable Version" src="https://img.shields.io/packagist/v/calchen/laravel-dingtalk.svg">
8+
</a>
9+
<a href="https://packagist.org/packages/calchen/laravel-dingtalk">
10+
<img alt="Total Downloads" src="https://img.shields.io/packagist/dt/calchen/laravel-dingtalk.svg">
11+
</a>
12+
<a href="https://github.com/calchen/laravel-dingtalk/blob/master/LICENSE">
13+
<img alt="License" src="https://img.shields.io/github/license/calchen/laravel-dingtalk.svg">
14+
</a>
15+
</p>
616

7-
Laravel/Lumen >= 5.1
17+
> [English](https://github.com/calchen/laravel-dingtalk/blob/master/README_en.md)
18+
19+
基于 [mingyoung/dingtalk](https://github.com/mingyoung/dingtalk) 封装的钉钉 SOK
820

921
## 安装
1022

1123
```shell
12-
composer require "calchen/laravel-dingtalk:~1.0"
24+
$ composer require calchen/laravel-dingtalk
1325
```
1426

15-
## 配置
16-
17-
### Laravel 应用
27+
### Laravel
1828

19-
1.`config/app.php` 注册 ServiceProvider 和 Facade (Laravel 5.5 无需手动注册)
29+
如果您的 Laravel 版本为 5.5 及以上,您不需要手动的配置文件中添加 `DingtalkServiceProvider` Laravel 自带的扩展包发现机制会处理好一切。如是小于 5.5 版本那么需要您进行如下操作:
2030

31+
打开位于 `app/Providers``AppServiceProvider.php` 文件并在 `register` 函数中添加如下内容:
2132
```php
22-
'providers' => [
23-
// ...
24-
Calchen\LaravelDingTalk\ServiceProvider::class,
25-
],
26-
'aliases' => [
27-
// ...
28-
'DingTalk' => Calchen\LaravelDingTalk\Facade::class,
29-
],
33+
$this->app->register(\Calchen\LaravelDingtalk\DingtalkServiceProvider::class);
3034
```
35+
您也可以在配置文件 `config/app.php` 中的 `providers` 中添加如下内容:
36+
```php
37+
Calchen\LaravelDingtalk\AliyunOssServiceProvider::class,
38+
```
39+
只需选择以上操作中的一种,即可加载本扩招包。
3140

32-
2. 创建配置文件:
33-
41+
再完成加载配置之后还需要将配置文件发布出来:
3442
```shell
35-
php artisan vendor:publish --provider="Calchen\LaravelDingTalk\ServiceProvider"
43+
php artisan vendor:publish --provider="Calchen\LaravelDingtalk\AliyunOssServiceProvider"
3644
```
3745

38-
3. 修改应用根目录下的 `config/dingtalk.php` 中对应的参数即可。
39-
40-
### Lumen 应用
46+
### Lumen
4147

42-
1.`bootstrap/app.php` 中 82 行左右:
48+
Lumen 并未移植扩展包自动发现机制,所以需要手动加载扩展包并复制配置文件。
4349

50+
打开配置文件 `bootstrap/app.php` 并在大约 81 行左右添加如下内容:
4451
```php
45-
$app->register(Calchen\LaravelDingTalk\ServiceProvider::class);
52+
$app->register(Calchen\LaravelDingtalk\AliyunOssServiceProvider::class);
4653
```
4754

48-
2. 如果你习惯使用 `config/dingtalk.php` 来配置的话,将 `vendor/calchen/laravel-dingtalk/src/config.php` 拷贝到`项目根目录/config`目录下,并将文件名改成`dingtalk.php`
55+
将文件系统配置文件从 `vendor/calchen/laravel-dingtalk/config/dingtalk.php` 复制到 `config/dingtalk.php`
56+
57+
## 配置
4958

50-
## 使用
59+
请参考 [EasyDingTalk](https://docs.easydingtalk.org/start.html) 文档
5160

52-
todo
61+
## 用法
5362

54-
会逐步增加 OAuth 相关的中间件、控制器及路由
63+
请参考 [EasyDingTalk](https://docs.easydingtalk.org/start.html) 文档
5564

65+
## 计划中功能
5666

57-
更多 SDK 的具体使用请参考:https://docs.easydingtalk.org
67+
计划逐步增加 OAuth 相关的中间件、控制器及路由
5868

59-
## License
69+
## 开源协议
6070

61-
MIT
71+
[MIT](http://opensource.org/licenses/MIT)

README_en.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<h1 align="center"> laravel-dingtalk </h1>
2+
3+
<p align="center"> Dingtalk SDK for Laravel/Lumen </p>
4+
5+
<p align="center">
6+
<a href="https://packagist.org/packages/calchen/laravel-dingtalk">
7+
<img alt="Latest Stable Version" src="https://img.shields.io/packagist/v/calchen/laravel-dingtalk.svg">
8+
</a>
9+
<a href="https://packagist.org/packages/calchen/laravel-dingtalk">
10+
<img alt="Total Downloads" src="https://img.shields.io/packagist/dt/calchen/laravel-dingtalk.svg">
11+
</a>
12+
<a href="https://github.com/calchen/laravel-dingtalk/blob/master/LICENSE">
13+
<img alt="License" src="https://img.shields.io/github/license/calchen/laravel-dingtalk.svg">
14+
</a>
15+
</p>
16+
17+
> [中文](https://github.com/calchen/laravel-dingtalk/blob/master/README.md)
18+
19+
This is a Flysystem adapter for the Aliyun OSS ~2.3.0
20+
21+
Depend on [apollopy/flysystem-aliyun-oss](https://github.com/apollopy/flysystem-aliyun-oss)
22+
23+
## Installing
24+
25+
```shell
26+
$ composer require calchen/laravel-dingtalk
27+
```
28+
29+
### Laravel
30+
31+
For Laravel >=5.5, no need to manually add `DingtalkServiceProvider` into config. It uses package auto discovery feature. Skip this if you are on >=5.5, if not:
32+
33+
Open your `AppServiceProvider` (located in `app/Providers`) and add this line in `register` function
34+
```php
35+
$this->app->register(\Calchen\LaravelDingtalk\DingtalkServiceProvider::class);
36+
```
37+
or open your `config/app.php` and add this line in `providers` section
38+
```php
39+
Calchen\LaravelDingtalk\DingtalkServiceProvider::class,
40+
```
41+
42+
Publish configuration file from `vendor/calchen/laravel-dingtalk/config/dingtalk.php` to `config/dingtalk.php`
43+
```shell
44+
php artisan vendor:publish --provider="Calchen\LaravelDingtalk\AliyunOssServiceProvider"
45+
```
46+
47+
### Lumen
48+
49+
Open your `bootstrap/app.php` and add this line
50+
```php
51+
$app->register(Calchen\LaravelDingtalk\DingtalkServiceProvider::class);
52+
```
53+
54+
Copy configuration file from `vendor/calchen/laravel-dingtalk/config/dingtalk.php` to `config/dingtalk.php`
55+
56+
## Configuration
57+
58+
Please check docs here [EasyDingTalk](https://docs.easydingtalk.org/start.html)
59+
60+
## Usage
61+
62+
Please check docs here [EasyDingTalk](https://docs.easydingtalk.org/start.html)
63+
64+
## License
65+
66+
[MIT](http://opensource.org/licenses/MIT)

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "calchen\/laravel-dingtalk",
2+
"name": "calchen/laravel-dingtalk",
33
"description": "钉钉 SDK for Laravel",
44
"license": "MIT",
55
"authors": [
@@ -14,16 +14,16 @@
1414
},
1515
"autoload": {
1616
"psr-4": {
17-
"Calchen\\LaravelDingTalk\\": "src"
17+
"Calchen\\LaravelDingtalk\\": "src"
1818
}
1919
},
2020
"extra": {
2121
"laravel": {
2222
"providers": [
23-
"Calchen\\LaravelDingTalk\\ServiceProvider"
23+
"Calchen\\LaravelDingtalk\\DingtalkServiceProvider"
2424
],
2525
"aliases": {
26-
"EasyDingTalk": "Calchen\\LaravelDingTalk\\Facade"
26+
"EasyDingtalk": "Calchen\\LaravelDingtalk\\Facade"
2727
}
2828
}
2929
}

src/config.php renamed to config/dingtalk.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
*/
2323
'app_secret' => env('DINGTALK_APP_SECRET'),
2424

25+
/**
26+
* 默认使用 Laravel 的 Cache 组件作为缓存
27+
*/
2528
'use_laravel_cache' => true,
2629

2730
/*

src/ServiceProvider.php renamed to src/DingtalkServiceProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22

3-
namespace Calchen\LaravelDingTalk;
3+
namespace Calchen\LaravelDingtalk;
44

55
use EasyDingTalk\Application;
66
use Illuminate\Foundation\Application as LaravelApplication;
77
use Illuminate\Support\Facades\Config;
88
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
99
use Laravel\Lumen\Application as LumenApplication;
1010

11-
class ServiceProvider extends LaravelServiceProvider
11+
class DingtalkServiceProvider extends LaravelServiceProvider
1212
{
1313
/**
1414
* Boot the provider.
@@ -22,7 +22,7 @@ public function boot()
2222
*/
2323
protected function setupConfig()
2424
{
25-
$source = realpath(__DIR__.'/config.php');
25+
$source = realpath(__DIR__.'/../config/dingtalk.php');
2626

2727
if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
2828
$this->publishes([$source => config_path('dingtalk.php')], 'laravel-dingtalk');

src/Facade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Calchen\LaravelDingTalk;
3+
namespace Calchen\LaravelDingtalk;
44

55
use EasyDingTalk\Application;
66
use Illuminate\Support\Facades\App;

0 commit comments

Comments
 (0)