a-lawrence/laravel-wonde
Composer 安装命令:
composer require a-lawrence/laravel-wonde
包简介
This is a bridge package for the Wonde API Client.
关键字:
README 文档
README
This is a simple bridge for the Wonde LTD API, using Graham Campbell's Laravel Manager package as a framework.
Installation
Add this package to your composer.json file:
composer require a-lawrence/laravel-wonde
Depending on your version of Laravel, it may be necessary to add your Service Provider to your config/app.php file:
... ALawrence\LaravelWonde\WondeServiceProvider::class, ...
Along with the Alias:
... 'Wonde' => ALawrence\LaravelWonde\Facades\Wonde::class, ...
Config
Within your .env file (or environment variables) you can define the following two elements:
WONDE_TOKEN=Your-Access-Token
WONDE_SCHOOL=Specific-School
You will only need to set WONDE_SCHOOL if your application is a single school application.
If you'd like more control over the configuration, you could always publish the config file for this package and modify as necessary:
php artisan vendor:publish --provider="ALawrence\LaravelWonde\WondeServiceProvider"
Usage
Basic usage can be carried out by utilising dependency injection within your controller:
class DemoController extends Controller { protected $wonde; public function __construct(WondeManager $wonde) { $this->wonde = $wonde; } public function display() { foreach ($this->wonde->schools->all() as $school) { // Display school name echo $school->name . PHP_EOL; } } }
If you'd prefer to not use dependency injection, then that's fine too:
public function display() { foreach (Wonde::connection("main")->schools->all() as $school) { // Display school name echo $school->name . PHP_EOL; } }
For all other usage, non-specific to this bridge, view the Wonde API Client documentation: https://github.com/wondeltd/php-client
统计信息
- 总下载量: 38
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-10-11