How to Build and Distribute Beautiful Command-Line Applications with PHP and Composer

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • valet

    A more enjoyable local development experience for Mac. (by laravel)

  • Valet

  • Psalm

    A static analysis tool for finding errors in PHP applications

  • Psalm

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • PHPStan

    PHP Static Analysis Tool - discover bugs in your code without running it!

  • PHPStan

  • phpinsights

    🔰 Instant PHP quality checks from your console

  • PHP Insights

  • PHP CS Fixer

    A tool to automatically fix PHP Coding Standards issues

  • PHP CS Fixer

  • PHP Code Sniffer

    PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.

  • PHP_CodeSniffer

  • Rector

    Instant Upgrades and Automated Refactoring of any PHP 5.3+ code

  • Rector

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • takeout

    Docker-based development-only dependency manager. macOS, Linux, and WSL2-only and installs via PHP's Composer... for now.

  • Takeout

  • minicli

    A minimalist framework for command-line applications in PHP

  • We won't use specialised frameworks like Minicli or Laravel Zero because the goal is not so much to focus on features but to better understand the development, testing, and distribution phases of command-line programs.

  • php-cli-demo

    PHP command-line tool demonstration

  • Make sure it behaves as you would expect – if it doesn't, go back a few steps or take a look at the tutorial's repository to check if you missed something.

  • Symfony

    The Symfony PHP framework

  • Our class extends Symfony Console's Command class and overwrites some of its static properties. $defaultName and $defaultDescription are the command's name and description, which will both appear in the application's menu. The former will also allow us to invoke the command in the terminal later on.

  • termwind

    🍃 In short, it's like Tailwind CSS, but for the PHP command-line applications.

  • Concerning styling, if you need to push the appearance of your console program a bit further, you might want to take a look at Termwind, a promising new framework described as "Tailwind CSS, but for PHP command-line applications".

  • kobwise

    Convert your Kobo annotations to Readwise highlights

  • Think of repetitive tasks that you perform regularly, and that could be automated away without the need of a full-blown website. I, for instance, grew tired of having to manually import my Kobo annotations to Readwise, so came up with a tool to make the conversion easier.

  • semver

    Semantic Versioning Specification

  • If you're wondering why I didn't list 8.1, that's because as per the rules of Semantic Versioning (semver), ^8.0 covers all versions above or equal to 8.0 but strictly under 9.0, which includes 8.1. If you're like me and tend to forget the rules of semver when you need them, keep this cheatsheet handy and thank me later.

  • PHPUnit

    The PHP Unit Testing framework.

  • We will use PHPUnit as our testing environment – let's instal it as a development dependency:

  • Packagist

    Package Repository Website - try https://packagist.com if you need your own -

  • Now head over to packagist.org and create an account (or sign in if you already have one).

  • Laravel-Zero

    A PHP framework for console artisans

  • We won't use specialised frameworks like Minicli or Laravel Zero because the goal is not so much to focus on features but to better understand the development, testing, and distribution phases of command-line programs.

  • starter-workflows

    Accelerating new GitHub Actions workflows

  • Now that we have a test controlling the correct execution of our program, we can use it to ensure the latter's compatibility with a range of PHP versions. Doing so manually would be a bit of a pain, but we can automate the process using GitHub Actions.

  • Puts Debuggerer

    Ruby library for improved puts debugging, automatically displaying bonus useful information such as source line number and source code.

  • A GitHub account (a free one will do)

  • Composer

    Dependency Manager for PHP

  • This tutorial will walk you through the process of creating a simple game running in the terminal, using Symfony's Console Component as a bedrock, GitHub Actions for compatibility checking, and Composer for distribution.

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts