Skip to content

flxtools is a PHP CLI framework designed for creating and managing custom commands with automatic generation, system status checks (internet, database connectivity), and professional console output.

License

Notifications You must be signed in to change notification settings

flowaxy/flxtools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flxtools: CLI Tool for Flowaxy Framework

It is a lightweight and fast command line interface implemented for the Flowaxy framework.


📖 Table of Contents

  1. Features
  2. Requirements
  3. Installation
  4. Autoloading
  5. Usage
  6. Project Structure
  7. Creating Custom Commands
  8. Tips and Recommendations
  9. Contributing & License

🔥 Features

  • Auto-registration: Any *Command.php file in App/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.

⚙️ Requirements

  • 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

📥 Installation

To integrate flxtools into your Flowaxy Framework:

  1. 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
    └── …
    
  2. Make the main script flxtools executable (Linux/macOS):

    chmod +x flxtools

🛠 Autoloading

Ensure your composer.json includes:

"autoload": {
  "psr-4": {
    "App\\": "App/"
  }
}

Then run:

composer dump-autoload

This allows automatic loading of classes from App/Console.


🚀 Usage

List Available Commands

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

Command Examples

php flxtools create:command   # Create command!
php flxtools help             # List command!
php flxtools ping             # Status CLI/Internet/Database

Create a New Command

php flxtools install Notify

This generates App/Console/Commands/NotifyCommand.php with a stub implementation.


📂 Project Structure

Project
├── App/
│   └── Console/
│       ├── Command.php
│       ├── Init.php
│       └── Commands/
│           └── *.php
├── flxtools
└── README.md

✍️ Creating Custom Commands

  1. Create a new file in App/Console/Commands, e.g., YourCommandCommand.php.

  2. Extend App\Console\Command and implement:

    • name(): string
    • description(): string
    • handle(array $args): void
  3. 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"; }
}

💡 Tips & Recommendations

  • 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.

🤝 Contributing & License

PRs and feedback are welcome! flxtools is licensed under the MIT License.


© 2025 Flowaxy Studio

About

flxtools is a PHP CLI framework designed for creating and managing custom commands with automatic generation, system status checks (internet, database connectivity), and professional console output.

Topics

Resources

License

Stars

Watchers

Forks

Languages