English | 中文
Box is committed to helping improve the programming experience of PHP applications, expecially for Hyperf, managing the PHP environment and related dependencies, providing the ability to package PHP applications as binary programs, and also providing reverse proxy services for managing and deploying Swoole/Swow applications.
wget https://github.com/hyperf/box/releases/download/v0.5.5/box_x86_64_macos -O box
sudo mv ./box /usr/local/bin/box
sudo chmod 755 /usr/local/bin/box
// Make sure /usr/local/bin/box in your $PATH env, or put `box` into any path in $PATH env that you wantwget https://github.com/hyperf/box/releases/download/v0.5.5/box_x86_64_linux -O box
sudo mv ./box /usr/local/bin/box
sudo chmod 755 /usr/local/bin/box
// Make sure /usr/local/bin/box in your $PATH env, or put `box` into any path in $PATH env that you wantAt present, we are short of AARCH64 Github Actions Runner, so we cannot timely construct the bin file of AARCH64 version.
wget https://github.com/hyperf/box/releases/download/v0.0.3/box_php8.1_aarch64_linux -O box
sudo mv ./box /usr/local/bin/box
sudo chmod 755 /usr/local/bin/box
// Make sure /usr/local/bin/box in your $PATH env, or put `box` into any path in $PATH env that you wantcurl -o box.exe https://github.com/hyperf/box/releases/download/v0.5.5/box_x64_windows.exe
// Put `box.exe` into any path in $PATH env that you want, and use `box.exe` instead of `box` when executing on WindowsBox needs a Github Access Token to request github api, to retrieve the versions of the package.
- Create Github Access Token, the
workflowscope have to be selected. - Run
box config set github.access-token <Your Token>to init the token. - Have fun ~
By default, Box is supported by Swow Kernel, but we also provide Swoole Kernel, you can switch to Swoole Kernel by box config set kernel swoole, but it should be noted that Swoole Kernel only supports PHP 8.1 version, and The Build Binaries feature and Windows Systems are not supported.
// set to Swow Kernel [default]
box config set kernel swow
// set to Swoole Kernel (NOT supported on Windows)
box config set kernel swoolebox get pkg@versionto install the package from remote automatically,pkgis the package name, andversionis the version of package,box get pkgmeans to install the latest version of pkg, for example, runbox get [email protected]to install the PHP 8.1, runbox get composerto install the latest composer binbox build-prepareto get ready forbuildandbuild-selfcommandbox build-selfto build theboxbin itselfbox build <path>to build a Hyperf application into a binary filebox self-updateto update theboxbin to latest versionbox config listto dump the config filebox config get <key>to retrieve the value by key from config filebox config set <key> <value>to set value by key into the config filebox config unset <key>to unset the config value by keybox config set-php-version <version>to set the current PHP version of box, available value: 8.0 | 8.1box config get-php-version <version>to get the current PHP version of boxbox reverse-proxy -u <upsteamHost:upstreamPort>to start a reverse proxy HTTP server for the upstream serversbox php <argument>to run any PHP command via current PHP version of boxbox composer <argument>to run any Composer command via box, the version of the composer bin depends on the last executedget composercommandbox php-cs-fixer <argument>to run anyphp-cs-fixercommand via box, the version of the composer bin depends on the last executedget php-cs-fixercommandbox cs-fix <argument>to runphp-cs-fix fixcommand via box, the version of the composer bin depends on the last executedget php-cs-fixercommandbox phpstan <argument>to run anyphpstancommand via box, the version of the composer bin depends on the last executedget phpstancommand, since box v0.3.0box pint <argument>to run anypintcommand via box, the version of the composer bin depends on the last executedget pintcommand, since box v0.3.0box versionto dump the current version of the box bin
If you want to experience the full features of Box, you need to run it based on the Swow Kernel, so you need to base your project on hyperf/swow-skeleton to run your project, you can create a Swow skeleton project based on Hyperf 3.0 RC version by box composer create-project hyperf/swow-skeleton:dev-master command.