Pular para o conteúdo principal

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.

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