asink/asink-php
Composer 安装命令:
composer require asink/asink-php
包简介
A PHP client for communicating with Asink
README 文档
README
A simple PHP client library for Asink.
Usage
Start Asink
$ asink server [asink] listening on :3000
Install package via composer
"require": { "asink/asink-php": "dev-master" }
Using Laravel?
Add the service provider in app/config/app.php
'providers' => [ 'Asink\Component\AsinkServiceProvider' ];
And you can also add the Facade if you'd like
'aliases' => [ 'Asink' => 'Asink\Component\AsinkFacade' ];
With Asink installed and running, in Laravel you can run command like so:
<?php Route::get('/asink-test', function() { Asink::addTask('make-directory', array( "command" => "mkdir", "args" => [ "my-dir-1", "my-dir-2" ] )); Asink::start(); });
Stand-alone
<?php require("vendor/autoload.php"); $client = new Asink\Component\Client(); $client->addTask("make-directory", array( "command" => "mkdir", "args" => [ "my-dir-1", "my-dir-2" ] )); $client->start();
Options
There are various options and things you can do in terms of organising your commands and in which way they are ran. Here are the docs for Asink which show what options can be used.
$client->addTask("do-ls", array( "command" => "mkdir", // The root command "args" => [ // Add command arguments as an array "my-dir-1", "my-dir-2" ], "count" => [1, 1], // How many times do we want to run it? "dir" => "~", // Which directory should it be ran in? "group" => "stuff", // Should it be ran as part of a group? "require" => "do-ls" // Do we require anything to run first? )); $client->addTask("do-ls", array( "command" => "ls" )); $client->start();
License
统计信息
- 总下载量: 34
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2014-10-27
