📱 For the full interactive experience, visit shellscript.download
load.sh php-rest-api
php-rest-api.sh: Install byjg/rest-reference-architecture in unattended mode
Usage (via loader):
load.sh php-rest-api -- <folder> --namespace=<name> --name=<name/name> \
[--mysql-uri=<uri>] [--install-examples=Y|n] [--version=<version>] \
[--php-version=<version>] [--timezone=<tz>] [--git-name=<name>] [--git-email=<email>]
Examples:
# Minimal installation
load.sh php-rest-api -- myproject --namespace=MyApp --name=mycompany/myapp
# Full configuration
load.sh php-rest-api -- myproject --namespace=MyApp --name=mycompany/myapp \
--mysql-uri=mysql://root:secret@mysql-container/mydb \
--install-examples=n --version="^6.0" --php-version=8.4 \
--timezone=America/New_York
Description:
- Creates a setup.json file in the parent directory for unattended installation
- Runs composer create-project with byjg/rest-reference-architecture
- Automatically configures the project using the provided parameters
- Cleans up the setup.json file after successful installation
- Idempotent: safe to re-run, though it will recreate the project folder
Required Arguments:
<folder> Target folder name where the project will be created
--namespace Project namespace (CamelCase, e.g., MyApp, Tutorial)
--name Composer package name (vendor/package format, e.g., mycompany/myapp)
Optional Arguments:
--mysql-uri MySQL connection string (default values: schema=mysql, host=mysql-container,
user=root, password=mysqlp455w0rd, dev db=localdev, test db=localtest)
--install-examples Install example code (Y or n, default: Y)
--version Composer version constraint (default: ^6.0)
--php-version PHP version for Docker (8.1, 8.2, 8.3, 8.4, default: current PHP version)
--timezone Server timezone (default: UTC)
--git-name Git user name for the project (default: from git config or "Your Name")
--git-email Git user email for the project (default: from git config or "[email protected]")
-h, --help Show this help and exit
Notes:
- Requires composer installed on the system or use load.sh php-docker first
- The setup.json file will be created in the parent directory of the target folder
- The setup.json file is automatically removed after successful installation
- If the target folder exists, the script will fail (safety measure)