Download the PHP package alcamo/cli without Composer
On this page you can find all versions of the php package alcamo/cli. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package cli
Usage example
#!/usr/bin/env php
exit((new ExampleCli([]))->run());
This example is contained in this package as a file in the bin
directory. If called as bin/example --help, it outputs
Usage: bin/example [options]
Options:
-f, --foo <arg> Set foo.
-h, --help Show help.
-q, --quiet Be less verbose.
-v, --verbose Be more verbose.
-V, --version Show version.
The invocation example --foo 42 outputs something like
[19:01:38] N Foo was set to 42
Adding verbosity with example --foo 42 -v leads to something like
[20:02:02.913675] N Foo was set to 42
[20:02:02.913771] I Info message.
Reducing verbosity with example --foo 42 -q creates no output.
This illustrates the basic ideas:
- Options, operands, commands etc. are defined by class constants in a
class derived from AbstractCli. See GetOpt.php for details. The
options
--help,--quiet,--verboseand--versionare predefined. AbstractCli::run()processes the options, displays the help text if requested, provides a logger with a log level depending on the verbosity, and executesinnerRun().- You implement
innerRun()to do the actual work. The return value ofinnerRun()becopme the program's exit code.
Another simple example is provided in bin/uuid-cli.
All versions of cli with dependencies
PHP Build Version
Package Version
Requires
php Version
7.3 - 8.5
alcamo/exception Version ^0.1
monolog/monolog Version ^2
ulrichsg/getopt-php Version ^3.4
alcamo/exception Version ^0.1
monolog/monolog Version ^2
ulrichsg/getopt-php Version ^3.4
The package alcamo/cli contains the following files
Loading the files please wait ...