PHPackages                             jwyuen/dotslash - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. jwyuen/dotslash

AbandonedLibrary[CLI &amp; Console](/categories/cli)

jwyuen/dotslash
===============

Dotslash: utils for quickly creating command line application in php

v0.3.2.4(7y ago)1155MITPHPPHP &gt;=5.3.0

Since Sep 17Pushed 7y ago1 watchersCompare

[ Source](https://github.com/jwyuen/dotslash)[ Packagist](https://packagist.org/packages/jwyuen/dotslash)[ RSS](/packages/jwyuen-dotslash/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (9)Dependencies (7)Versions (9)Used By (0)

Dotslash (for PHP)
==================

[](#dotslash-for-php)

What is it?
-----------

[](#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

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.

What is the purpose?
--------------------

[](#what-is-the-purpose)

The purpose is to simplify creation of command line scripts

Install
-------

[](#install)

Just add to your composer.json like:

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

Usage
-----

[](#usage)

Create a class that extends the \\Dotslash\\BaseCommand class. Your class should extend the following functions:

```
// 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

Config Structure
----------------

[](#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:

Example dotslash-config.php:

```
