It is a lightweight and fast command line interface implemented for the Flowaxy framework.
- Features
- Requirements
- Installation
- Autoloading
- Usage
- Project Structure
- Creating Custom Commands
- Tips and Recommendations
- Contributing & License
- Auto-registration: Any
*Command.php
file inApp/Console/Commands
is automatically registered as a command. - Dependency-free: Built on pure PHP without external libraries.
- PSR‑12 compliant: Strict typing and clean architecture.
- Demo commands:
help
,create:command
,ping
for quick testing. - Easy extension: Add new commands without modifying core code.
- Flowaxy Framework v1.x: https://github.com/flowaxy/framework
- PHP ≥ 8.2 with
declare(strict_types=1)
enabled - PSR-4 autoloading configured (
App\
→App/
) - In project root:
App/Console
directory- Executable script
flxtools
To integrate flxtools into your Flowaxy Framework:
-
Clone the flxtools repository into the
Console
directory of your project:cd path/to/flowaxy/framework git clone https://github.com/flowaxy/flxtools.git Console
Or unzip the archive so that you end up with:
Project ├── App/Console/ │ └── flxtools └── …
-
Make the main script
flxtools
executable (Linux/macOS):chmod +x flxtools
Ensure your composer.json
includes:
"autoload": {
"psr-4": {
"App\\": "App/"
}
}
Then run:
composer dump-autoload
This allows automatic loading of classes from App/Console
.
php flxtools
If flxtools
is executable:
./flxtools
Output example:
Available commands:
help Display help information
create:command Create a new CLI command
ping Check CLI availability
php flxtools create:command # Create command!
php flxtools help # List command!
php flxtools ping # Status CLI/Internet/Database
php flxtools install Notify
This generates App/Console/Commands/NotifyCommand.php
with a stub implementation.
Project
├── App/
│ └── Console/
│ ├── Command.php
│ ├── Init.php
│ └── Commands/
│ └── *.php
├── flxtools
└── README.md
-
Create a new file in
App/Console/Commands
, e.g.,YourCommandCommand.php
. -
Extend
App\Console\Command
and implement:name(): string
description(): string
handle(array $args): void
-
Run
php flxtools
to see your command listed.
Example:
<?php
namespace App\Console\Commands;
use App\Console\Command;
class BuildCommand extends Command
{
public function name(): string { return 'build'; }
public function description(): string { return 'Run build tasks'; }
public function handle(array $args): void { echo "Building project...\n"; }
}
- Use concise and descriptive command names (e.g.,
make:controller
). - For grouped commands, enhance
ConsoleKernel
lookup logic. - Add ANSI colors for better CLI UX.
- Integrate with CI/CD:
composer ft lint
,composer ft test
.
PRs and feedback are welcome! flxtools is licensed under the MIT License.
© 2025 Flowaxy Studio