2017 © Pedro Peláez
 

library asink-php

A PHP client for communicating with Asink

image

asink/asink-php

A PHP client for communicating with Asink

  • Tuesday, October 28, 2014
  • by harry-lawrence
  • Repository
  • 1 Watchers
  • 0 Stars
  • 28 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Asink PHP

A simple PHP client library for Asink., (*1)

Usage

Start Asink

$ asink server
[asink] listening on :3000

Install package via composer, (*2)

"require": {
    "asink/asink-php": "dev-master"
}

Using Laravel?

Add the service provider in app/config/app.php, (*3)

'providers' => [
    'Asink\Component\AsinkServiceProvider'
];

And you can also add the Facade if you'd like, (*4)

'aliases' => [
    'Asink' => 'Asink\Component\AsinkFacade'
];

With Asink installed and running, in Laravel you can run command like so:, (*5)

<?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., (*6)

$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

MIT, (*7)


Ground Six, (*8)

The Versions

28/10 2014

dev-master

9999999-dev

A PHP client for communicating with Asink

  Sources   Download

The Requires

 

The Development Requires

library client groundsix asink