2017 © Pedro Peláez
 

library dotslash

Dotslash: utils for quickly creating command line application in php

image

jwyuen/dotslash

Dotslash: utils for quickly creating command line application in php

  • Friday, February 23, 2018
  • by jwingy
  • Repository
  • 1 Watchers
  • 1 Stars
  • 81 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 9 % Grown

The README.md

Dotslash (for PHP)

What is it?

A php library that allows you to make command line scripts quickly in PHP with conveniences that most command line scripts should have such as: - logging - email notifications on failure - easy way to take in and parse command line options - execution timer - nice looking console output, (*1)

This library is mostly a wrapper over the excellent Symfony Console library, but with added functionality that doesn't exist in the Console library such as logging, email notifications, and a execution timer., (*2)

What is the purpose?

The purpose is to simplify creation of command line scripts, (*3)

Install

Just add to your composer.json like:, (*4)

{
  "require": {
    "jwyuen/dotslash": "0.*"
  }
}

Usage

Create a class that extends the \Dotslash\BaseCommand class. Your class should extend the following functions:, (*5)

// See: http://symfony.com/doc/current/components/console/introduction.html
configure()

// Code to execute
executeCommand()

// Any input validation code you want.  Should return boolean, or optionally a
// custom string with the failure message you specify (only in the case of user
// input failing).  If validation passes, this should always return true.
checkValidInput()

// The path to a configuration file if you want to use logging and email
// notifications.  Should return a string if you have a config, or null if you
// don't want to use logging and email functionality
getConfigPath()

You'll then need an entry point script from which you'll run your command line script. An example is located in sample/console.php, (*6)

Config Structure

If you decide you want to enable logging and email functionality, you'll need to create a config file with the following name and contents/structure:, (*7)

Example dotslash-config.php:, (*8)

<?php

return array(
  'ses-email' => array(
    'aws-access-key' => '<your_access_key_here>',
    'aws-secret-key' => '<your_secret_key_here>',
    'region' => 'us-east-1',
    'email-recipient' => 'dev@dev.com'
  ),
  'logging' => array(
    'log-directory' => '/home/user/logs/'
  )
);

As you can tell from the example config, you'll need an AWS account to send emails via Simple Email Service. There may be support for other email options in the future., (*9)

The Versions

23/02 2018

dev-master

9999999-dev

Dotslash: utils for quickly creating command line application in php

  Sources   Download

MIT MIT License

The Requires

 

The Development Requires

by James Yuen

php command command-line command line

23/02 2018

v0.3.2.3

0.3.2.3

Dotslash: utils for quickly creating command line application in php

  Sources   Download

MIT

The Requires

 

The Development Requires

by James Yuen

php command command-line command line

11/10 2017

v0.3.2.2

0.3.2.2

Dotslash: utils for quickly creating command line application in php

  Sources   Download

MIT License

The Requires

 

The Development Requires

by James Yuen

php command command-line command line

11/10 2017

v0.3.2.1

0.3.2.1

Dotslash: utils for quickly creating command line application in php

  Sources   Download

MIT License

The Requires

 

The Development Requires

by James Yuen

php command command-line command line

11/10 2017

v0.3.2

0.3.2.0

Dotslash: utils for quickly creating command line application in php

  Sources   Download

MIT License

The Requires

 

The Development Requires

by James Yuen

php command command-line command line

12/03 2015

v0.3.1

0.3.1.0

Dotslash: utils for quickly creating command line application in php

  Sources   Download

MIT License

The Requires

 

The Development Requires

by James Yuen

php command command-line command line

22/09 2014

v0.3

0.3.0.0

Dotslash: utils for quickly creating command line application in php

  Sources   Download

MIT License

The Requires

 

The Development Requires

by James Yuen

php command command-line command line

18/09 2014

v0.2

0.2.0.0

Dotslash: utils for quickly creating command line application in php

  Sources   Download

MIT License

The Requires

 

The Development Requires

by James Yuen

php command command-line command line

17/09 2014

v0.1

0.1.0.0

Dotslash: utils for quickly creating command line application in php

  Sources   Download

MIT License

The Requires

 

The Development Requires

by James Yuen

php command command-line command line