Search by

byjg / scriptify

byjg

Transform any PHP class into an executable script callable from the command line without changes or refactoring.

Package info

github.com/byjg/php-scriptify

pkg:composer/byjg/scriptify

Statistics

Installs: 1 660

Dependents: 4

Suggesters: 0

Stars: 0

Open Issues: 0

6.0.0 2025-11-25 00:12 UTC

This package is auto-updated.

Last update: 2026-10-25 23:50:32 UTC


README

sidebar_key scriptify
sidebar_category infrastructure
tags
php cli

Scriptify: PHP Methods as Commands and Services

Run any existing PHP method from the command line, or install it as a system service, without writing a command class.

Sponsor Build Status Opensource ByJG Install MCP Server GitHub source GitHub license GitHub release

Why

To call your code from a shell, a cron job or a daemon, frameworks make you write a command class for each task: parse the arguments, build the dependencies, call the method. The method you wanted to run already exists.

Scriptify calls it directly:

scriptify run "App/Service/Report::rebuild" --arg 2026-10      # once, from the shell
scriptify install --template=crond nightly-report \
    --class "App/Service/Report::rebuild" --rootdir /srv/app   # as a cron job or systemd service
  • No glue code. The arguments are passed to the method's parameters, and with a PSR-11 container the class gets its constructor dependencies.
  • From shell to service in one step. install writes the systemd, cron, upstart or init.d service with the full command line.
  • A command line for your app. Launcher maps short names (php app report:rebuild) to methods, and scriptify terminal opens a REPL with your autoloader.

Features

Scriptify allows you to:

  • Call any PHP method from the command line
  • Install PHP classes/methods as system services (daemon, cron, etc.)
  • Call REST endpoints from shell scripts
  • Open an interactive PHP terminal with your project's autoloader
  • Pass environment variables to your scripts

Documentation

Installation

Scriptify does not need to be associated with your PHP project.

Install Locally (Recommended)

composer require "byjg/scriptify"

Install Globally

composer global require "byjg/scriptify"
sudo ln -s /root/.composer/vendor/bin/scriptify /usr/local/bin/scriptify

# If you want to share this installation with other users, consider using:
chmod a+x /root
# Note: The root directory will remain unreadable for them, but they can execute scriptify

Running Tests

vendor/bin/phpunit

Open source ByJG