Skip to content

Commit 01d100e

Browse files
author
link
committed
add 目录解构
1 parent 8f23eb6 commit 01d100e

File tree

8 files changed

+218
-1
lines changed

8 files changed

+218
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
.idea

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016 Link
3+
Copyright (c) 2016 link1st
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,39 @@
11
# laravel-easemob
22
环信及时通讯laravel包开发,用于环信用户、群、聊天室等功能
3+
4+
## 安装
5+
加载包
6+
7+
`"link1st/laravel-test": "dev-master"`
8+
9+
在配置文件中添加 **config/app.php**
10+
11+
```php
12+
'providers' => [
13+
/**
14+
* 添加供应商
15+
*/
16+
link1st\test\TestServiceProvider::class,
17+
],
18+
'aliases' => [
19+
/**
20+
* 添加别名
21+
*/
22+
'test'=>link1st\test\Facades\Test::class,
23+
],
24+
```
25+
26+
生成配置文件
27+
28+
`php artisan vendor:publish`
29+
30+
## 使用
31+
```php
32+
// 使用自动加载直接使用
33+
$link = new \link1st\test\easemob();
34+
echo $link->get_config();
35+
36+
// 使用门面使用
37+
echo \test::get_config();
38+
echo \test::index();
39+
```

composer.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "link1st/laravel-easemob",
3+
"description": "环信及时通讯laravel包开发,用于环信用户、群、聊天室等功能",
4+
"license": "MIT",
5+
"minimum-stability": "stable",
6+
"type": "library",
7+
"require": {
8+
"php": ">=5.6.4"
9+
},
10+
"authors": [
11+
{
12+
"name": "link1st",
13+
"email": "link12stl@gmail.com"
14+
}
15+
],
16+
"autoload": {
17+
"psr-4": {
18+
"link1st\\Easemob\\": "src/"
19+
}
20+
}
21+
}

src/EasemobServiceProvider.php

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php namespace link1st\Easemob;
2+
3+
use Illuminate\Support\ServiceProvider;
4+
5+
class TestServiceProvider extends ServiceProvider {
6+
7+
/**
8+
* Indicates if loading of the provider is deferred.
9+
*
10+
* @var bool
11+
*/
12+
protected $defer = false;
13+
14+
/**
15+
* 引导程序
16+
*
17+
* Bootstrap the application services.
18+
*
19+
* @return void
20+
*/
21+
public function boot()
22+
{
23+
24+
// 发布配置文件 + 可以发布迁移文件
25+
$this->publishes([
26+
__DIR__.'/config/easemob.php' => config_path('easemob.php'),
27+
]);
28+
29+
}
30+
31+
/**
32+
* 默认包位置
33+
*
34+
* Register the service provider.
35+
*
36+
* @return void
37+
*/
38+
public function register()
39+
{
40+
// 将给定配置文件合现配置文件接合
41+
$this->mergeConfigFrom(
42+
__DIR__.'/config/easemob.php', 'easemob'
43+
);
44+
45+
// 容器绑定
46+
$this->app->bind('Easemob', function () {
47+
return new easemob();
48+
});
49+
}
50+
51+
/**
52+
* Get the services provided by the provider.
53+
*
54+
* @return array
55+
*/
56+
public function provides()
57+
{
58+
return [];
59+
}
60+
61+
}

src/Facades/Easemob.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php namespace link1st\Easemob\Facades;
2+
3+
use Illuminate\Support\Facades\Facade;
4+
5+
class Easemob extends Facade
6+
{
7+
8+
/**
9+
*
10+
* Get the registered name of the component.
11+
*
12+
* @return string
13+
*/
14+
protected static function getFacadeAccessor()
15+
{
16+
return 'Easemob';
17+
}
18+
}

src/app/Easemob.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php namespace link1st\Easemob;
2+
3+
use Config ;
4+
5+
class Easemob
6+
{
7+
8+
/**
9+
* 获取配置项
10+
* @return int
11+
*/
12+
function get_config(){
13+
return Config::get('easemob.EASEMOB_DOMAIN',"");
14+
}
15+
16+
17+
/**
18+
* 默认
19+
* @return mixed
20+
*/
21+
public function index(){
22+
return 'index';
23+
}
24+
25+
};

src/config/easemob.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
return [
4+
/*
5+
|--------------------------------------------------------------------------
6+
| 企业的唯一标识
7+
|--------------------------------------------------------------------------
8+
|
9+
| 开发者在环信开发者管理后台注册账号时填写的企业 ID
10+
*/
11+
12+
'org_name' => env('ORG_NAME', ''),
13+
14+
/*
15+
|--------------------------------------------------------------------------
16+
| “APP”唯一标识
17+
|--------------------------------------------------------------------------
18+
|
19+
| 开发者在环信开发者管理后台创建应用时填写的“应用名称”
20+
*/
21+
22+
'app_name' => env('APP_NAME', ''),
23+
24+
/*
25+
|--------------------------------------------------------------------------
26+
| 环信开发者管理后台注册时填写的“用户名”
27+
|--------------------------------------------------------------------------
28+
|
29+
| 开发者在环信开发者管理后台创建应用时填写的“应用名称”
30+
*/
31+
32+
'org_admin' => env('ORG_ADMIN', ''),
33+
34+
/*
35+
|--------------------------------------------------------------------------
36+
| 一个 APP 的唯一标识
37+
|--------------------------------------------------------------------------
38+
|
39+
| 规则是 ${org_name}#${app_name}
40+
*/
41+
42+
'app_key' => env('APP_KEY', ''),
43+
44+
/*
45+
|--------------------------------------------------------------------------
46+
| token缓存时间
47+
|--------------------------------------------------------------------------
48+
|
49+
| token 有效时间,以秒为单位
50+
*/
51+
52+
'token_cache_time' => env('token_cache_time',7*24*60*60)
53+
];

0 commit comments

Comments
 (0)