Download the PHP package neuron-php/cli without Composer

On this page you can find all versions of the php package neuron-php/cli. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cli

CI codecov

Neuron CLI Component

A unified command-line interface for the Neuron PHP framework that provides a modern, extensible CLI tool for all Neuron components.

Features

Requirements

Installation

Local Installation (Recommended)

After installation, the CLI will be available at:

Global Installation

Make sure your global Composer bin directory is in your PATH, then:

Basic Usage

List All Commands

Get Help

Config Export

Export a YAML config as environment-style pairs for production.

Notes:

For Component Developers

The CLI component provides two ways for your component to register commands:

Method 1: CLI Provider Class (Recommended)

This is the preferred method as it keeps all command registrations in one place.

  1. Update your component's composer.json:

  2. Create the provider class:

Method 2: Direct Registration

For simpler cases, you can register commands directly in composer.json:

Creating Command Classes

All commands must extend the base Command class:

Command Naming Conventions

Built-in Commands

Core Commands

Command Description Usage
help Display help for a command neuron help [command]
list List all available commands neuron list
version Show version information neuron version [--verbose]
config:env Export neuron.yaml as KEY=VALUE pairs neuron config:env [--config=...] [--category=...] [--format=dotenv|shell] [--quote=...]

Output Helpers

The Output class provides rich formatting options:

Basic Output

Tables

Progress Bars

Interactive Input

The CLI component provides full support for interactive user input in commands:

Interactive Input Methods

Method Description Example
isInteractive() Check if terminal supports interaction if ($this->input->isInteractive())
ask($question, $default) Ask for text input $name = $this->input->ask('Name?', 'John')
confirm($question, $default) Ask yes/no question if ($this->input->confirm('Continue?', true))
askSecret($question) Ask for hidden input (passwords) $pass = $this->input->askSecret('Password')
choice($question, $choices, $default, $multiple) Select from options $opt = $this->input->choice('Pick:', ['A', 'B'])
readLine($prompt) Read raw input line $line = $this->input->readLine('> ')

Example: Interactive Setup Command

Secret Input (Passwords)

The askSecret() method hides user input, perfect for passwords and sensitive data:

Choice Selection

The choice() method presents options for selection:

How Command Discovery Works

  1. Installation Detection: When neuron is run, the ComponentLoader scans for installed packages
  2. Package Filtering: Only neuron-php/* packages are considered
  3. Configuration Check: Each package's composer.json is checked for CLI configuration
  4. Provider Loading: If a CLI provider is found, its register() method is called
  5. Direct Registration: Any directly listed commands are registered
  6. Project Commands: The root project's composer.json is also checked

This automatic discovery means:

Error Handling

Commands should return appropriate exit codes:

Example:

Testing Your Commands

The CLI component provides comprehensive testing support, including the ability to test commands that require user input.

Testing Commands Without User Input

Testing Commands With User Input

Commands that use prompt(), confirm(), secret(), or choice() can be tested using the TestInputReader:

Using Input Reader in Commands

To make your commands testable, use the convenience methods provided by the Command base class:

These convenience methods automatically use the injected IInputReader, making your commands fully testable without requiring actual user input.

TestInputReader Features

The TestInputReader class provides:

Contributing

When adding new features to the CLI component:

  1. Extend the Command base class for new commands
  2. Add tests in the tests/ directory
  3. Update this README with new features
  4. Follow PSR-4 naming conventions
  5. Use the existing code style (tabs, spaces etc)

License

This component is part of the Neuron PHP Framework and is released under the MIT License.


All versions of cli with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
neuron-php/application Version 0.8.*
neuron-php/data Version 0.9.*
symfony/yaml Version ^6.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package neuron-php/cli contains the following files

Loading the files please wait ...