• Stars
    star
    130
  • Rank 277,575 (Top 6 %)
  • Language
    PHP
  • Created over 2 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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.

English | 中文

box, by Hyperf

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.

This is still an early experimental version, have fun ~

Usage

Install box

Mac
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 want
Linux x86_64
wget 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 want
Linux aarch64

At 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 want
Windows
curl -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 Windows

Init Github Access Token

Box needs a Github Access Token to request github api, to retrieve the versions of the package.

  1. Create Github Access Token, the workflow scope have to be selected.
  2. Run box config set github.access-token <Your Token> to init the token.
  3. Have fun ~

Setting the Box Kernel

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 swoole

Commands

  • box get pkg@version to install the package from remote automatically, pkg is the package name, and version is the version of package, box get pkg means to install the latest version of pkg, for example, run box get [email protected] to install the PHP 8.1, run box get composer to install the latest composer bin
  • box build-prepare to get ready for build and build-self command
  • box build-self to build the box bin itself
  • box build <path> to build a Hyperf application into a binary file
  • box self-update to update the box bin to latest version
  • box config list to dump the config file
  • box config get <key> to retrieve the value by key from config file
  • box config set <key> <value> to set value by key into the config file
  • box config unset <key> to unset the config value by key
  • box config set-php-version <version> to set the current PHP version of box, available value: 8.0 | 8.1
  • box config get-php-version <version> to get the current PHP version of box
  • box reverse-proxy -u <upsteamHost:upstreamPort> to start a reverse proxy HTTP server for the upstream servers
  • box php <argument> to run any PHP command via current PHP version of box
  • box composer <argument> to run any Composer command via box, the version of the composer bin depends on the last executed get composer command
  • box php-cs-fixer <argument> to run any php-cs-fixer command via box, the version of the composer bin depends on the last executed get php-cs-fixer command
  • box cs-fix <argument> to run php-cs-fix fix command via box, the version of the composer bin depends on the last executed get php-cs-fixer command
  • box phpstan <argument> to run any phpstan command via box, the version of the composer bin depends on the last executed get phpstan command, since box v0.3.0
  • box pint <argument> to run any pint command via box, the version of the composer bin depends on the last executed get pint command, since box v0.3.0
  • box version to dump the current version of the box bin

About Swow Skeleton

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.

More Repositories

1

hyperf

🚀 A coroutine framework that focuses on hyperspeed and flexibility. Building microservice or middleware with ease.
PHP
6,139
star
2

nano

🧬 Nano is a zero-config, no skeleton, minimal Hyperf distribution that allows you to quickly build a Hyperf application with just a single PHP file.
PHP
355
star
3

hyperf-docker

🐳 The docker image offered by Hyperf.
Dockerfile
288
star
4

hyperf-skeleton

🛠 A skeleton of Hyperf framework that provided by official team
PHP
238
star
5

gotask

⚡️ A lightning speed replacement for Swoole TaskWorker in Go
PHP
219
star
6

jet

🚀 Jet is a unification model RPC Client, built-in JSON RPC protocol, available to running in ALL PHP environments, including PHP-FPM and Swoole/Hyperf environments.
PHP
53
star
7

biz-skeleton

Business Web Api Skeleton
PHP
43
star
8

hyperf-admin

43
star
9

swow-skeleton

Skeleton for Swow
PHP
40
star
10

xxl-job-incubator

PHP
33
star
11

snowflake

A snowflake component.
PHP
23
star
12

nacos

A PHP implementation of Nacos OpenAPI, particularly adapt for Hyperf.
PHP
21
star
13

socketio-server

[READ ONLY]
PHP
19
star
14

swagger

PHP
18
star
15

di

PHP
17
star
16

watcher

[READ ONLY]
PHP
17
star
17

amqp

PHP
16
star
18

mqtt-server-incubator

PHP
14
star
19

database

PHP
13
star
20

engine-swow

PHP
13
star
21

database-pgsql-incubator

PHP
13
star
22

roc

Channel driven multiplexing connection for Golang.
Go
13
star
23

crontab

Crontab component.
PHP
13
star
24

graphql

PHP
12
star
25

odin

PHP
12
star
26

swoole-tracker

PHP
11
star
27

dag-incubator

Directed Acyclic Graph
PHP
11
star
28

validation

Validation component for Hyperf
PHP
11
star
29

okr

实战项目 - OKR系统
PHP
10
star
30

http-server

PHP
10
star
31

aop-integration

AOP Integration
PHP
10
star
32

async-queue

PHP
10
star
33

guzzle

PHP
9
star
34

rpc-multiplex

[READ ONLY] Rpc for multiplexing connection
PHP
9
star
35

database-pgsql

[READ ONLY] A pgsql handler for hyperf/database
PHP
9
star
36

rpc-multiplex-incubator

Rpc for multiplexing connection
PHP
8
star
37

reactive-x

[READ ONLY]
PHP
8
star
38

tracer

PHP
8
star
39

utils

8
star
40

db-connection

PHP
7
star
41

elasticsearch

PHP
7
star
42

translation

A independent translation component
PHP
7
star
43

task

Task component.
PHP
7
star
44

engine

PHP
7
star
45

redis

PHP
7
star
46

websocket-server

WebSocket Server for Hyperf.
PHP
7
star
47

scout

[READ ONLY] A driver based solution to searching your models. Inspired By Laravel Scout.
PHP
7
star
48

flysystem-oss

Aliyun OSS Adapter for Flysystem v2.0
PHP
7
star
49

rpn

[READ ONLY] Reverse Polish Notation
PHP
7
star
50

multiplex

channel driven multiplexing connection
PHP
7
star
51

dag

Directed Acyclic Graph
PHP
6
star
52

component-creator

Hyperf component creater.
PHP
6
star
53

etcd

PHP
6
star
54

composer-plugin

Plugin for Composer
PHP
6
star
55

metric

[READ ONLY]
PHP
6
star
56

kafka

[READ ONLY] Kafka client for Hyperf
PHP
6
star
57

roc-generator

Generator for `hyperf/roc` and `hyperf/rpc-multiplex`.
PHP
6
star
58

multiplex-socket

Socket for channel driven multiplexing connection
PHP
6
star
59

framework

PHP
5
star
60

config-apollo

PHP
5
star
61

nats

[READ ONLY] Nats for hyperf.
PHP
5
star
62

config-aliyun-acm

PHP
5
star
63

db-pgsql-incubator

PgSQL driver for Hyperf DB Component
PHP
5
star
64

rate-limit

PHP
5
star
65

view

[READ ONLY] View component.
PHP
5
star
66

load-balancer

PHP
5
star
67

super-globals

[READ ONLY]
PHP
5
star
68

nsq

[READ ONLY] Nsq component
PHP
5
star
69

session

PHP
5
star
70

filesystem

[READ ONLY]
PHP
5
star
71

config

PHP
5
star
72

command

PHP
5
star
73

signal

[READ ONLY]
PHP
4
star
74

grpc-server

PHP
4
star
75

contract

PHP
4
star
76

view-engine

[READ ONLY] Laravel View Engine for Hyperf
PHP
4
star
77

grpc-client

PHP
4
star
78

docker-ci

Image for Gitlab CI
Dockerfile
4
star
79

server

PHP
4
star
80

http-message

PHP
4
star
81

rpc-client

PHP
4
star
82

logger

PHP
4
star
83

json-rpc

PHP
4
star
84

pool

PHP
4
star
85

octopus

A distributed project base on Hyperf.
PHP
4
star
86

websocket-client

Hyperf WebSocket Client
PHP
4
star
87

migration-generator-incubator

Migration Generator which used to generatie migrations from an existing table structure for Hyperf.
PHP
3
star
88

constants

PHP
3
star
89

rpn-incubator

Reverse Polish Notation Calculator
PHP
3
star
90

dispatcher

PHP
3
star
91

cache

PHP
3
star
92

scan-manager-incubator

PHP
3
star
93

phar

[READ ONLY]
PHP
3
star
94

http2-client

The HTTP2 Client for Hyperf.
PHP
3
star
95

testing

PHP
3
star
96

hyperf.io

The official site of Hyperf
JavaScript
3
star
97

grpc

PHP
3
star
98

macroable

Hyperf Macroable package which come from `illuminate/macroable`.
PHP
3
star
99

paginator

PHP
3
star
100

qdrant-client

PHP
2
star