Work in Progress
This project is still under development. Some features may be incomplete or subject to change.
Currently,
Hard
is only supported on Linux. For Windows users, it can be run using WSL (Windows Subsystem for Linux). Mac support has not been tested (I don't have a Mac to test it).
PHP Hard
is a Docker-based environment designed to streamline the development and management of Laravel projects. It comes with pre-configured services like PHP, Composer, Node.js, Yarn, and more, enabling you to easily manage your application and its dependencies in a containerized environment.
- Features
- Installation
- Configuration
- Docker Commands
- Laravel Commands
- Artisan Commands
- PHP Commands
- Composer Commands
- Node Commands
- NPM Commands
- Yarn Commands
- Help Command
- Containerized Environment: Seamlessly run your Laravel application within Docker.
- Auto-Generated Domains: Access your projects via
*.localhost
domains effortlessly after creating or cloning a project inside the hard directory. - PHP 8.3: Pre-installed PHP 8.3 for your development needs.
- Composer: Efficiently manage PHP dependencies with Composer.
- Node.js: Execute Node.js commands and compile JavaScript assets.
- Yarn: Handle JavaScript dependencies and build assets using Yarn.
- NPM: Utilize NPM commands for managing JavaScript dependencies.
- Artisan: Run Laravel Artisan commands directly within the container.
- Queue Management: Operate queue workers or Horizon within the container.
- Database: Comes with MariaDB.
- Minio: Utilize S3-compatible object storage for local development.
- Flexible Configuration: Easily customize environment settings to match your requirements.
To get started, you’ll need Docker and Docker Compose installed on your machine. If you haven't already, please follow the installation guides for Docker and Docker Compose.
Once Docker is set up, run the following command to install PHP Hard
:
bash <(wget -q -O - https://raw.githubusercontent.com/clebsonsh/hard/refs/heads/main/install.sh)
PHP Hard
offers configuration options with reasonable defaults, easily customizable to fit your needs. Modify the settings in ~/.hard/.env
to suit your preferences.
-
WWW_PATH
: The directory where your projects are located. Default:~/hard
- Any project you create or clone in this directory can be accessed on
*.localhost
. - Example: After running
hard laravel new awesome-project
, simply open http://awesome-project.localhost and it’ll be ready to go!
- Any project you create or clone in this directory can be accessed on
-
QUEUE_COMMAND
: Command to run your application queues. Default:queue:work
- Can be changed to
queue:work --tries=3
, for example. - If you prefer to run Horizon, you can change it to
horizon
.
- Can be changed to
-
DB_USERNAME
: Database user. Default:root
-
DB_PASSWORD
: Database password. Default:password
-
AWS_ACCESS_KEY_ID
: Minio user. Default:root
-
AWS_SECRET_ACCESS_KEY
: Minio password. Default:password
These commands allow you to manage the Docker containers:
hard up
: Start the Docker environment.hard up -d
: Start the Docker environment in detached mode (background).hard down
: Stop the environment and shut down all containers.hard restart
: Restart the environment (containers).hard ps
: Display the status of all containers.hard bash
: Start a shell session within the app container.
These commands help you interact with the Laravel application using Docker:
hard laravel ...
: Run Laravel commands.- Example:
hard laravel new awesome-project
to create a new project inside theWWW_PATH
directory.
- Example:
Use these commands to interact with Laravel's Artisan CLI tool:
hard [project] artisan ...
: Run Artisan commands inside the container.- Example:
hard awesome-project artisan migrate
to run the migrations for theawesome-project
.
- Example:
Use these commands to run PHP scripts or check the PHP version:
hard [project] php ...
: Run a PHP command or script inside the container.- Example:
hard awesome-project php artisan migrate
to run the migrations forawesome-project
.
- Example:
These commands allow you to manage dependencies and run Composer commands within the container:
hard [project] composer ...
: Run Composer commands inside the container.- Example:
hard awesome-project composer require laravel/sanctum
to install a package.
- Example:
Execute Node.js commands within the container:
hard [project] node ...
: Run any Node.js command.- Example:
hard awesome-project node --version
to check the Node.js version.
- Example:
For the Vite dev server, be sure to add the proper server config in vite.config.js
.
Ports 5173 to 5180 are available, so you can run multiple instances of the Vite dev server:
server: {
host: '0.0.0.0',
hmr: { host: '127.0.0.1' },
},
Run NPM commands within the container to manage JavaScript dependencies:
hard [project] npm ...
: Run any NPM command.- Example:
hard awesome-project npm run prod
to build the production assets.
- Example:
Execute Yarn commands within the container:
hard [project] yarn ...
: Run any Yarn command.- Example:
hard awesome-project yarn prod
to build production assets.
- Example:
To see a list of all available commands and get help on using them, run:
hard --help
This will display the full list of commands you can use to manage your Laravel project with Docker.
This project is licensed under the MIT License - see the LICENSE file for details.