Easy Deploy is a Laravel package that simplifies deployment automation. It combines common tasks like migrations, cache management, and queue restarts into a single Artisan command, ensuring smooth and efficient deployments with minimal effort
Hi, I'm Sulaiman Misri. Currently I'm working as a Senior Full Stack Engineer at one of the Big Four Companies in Malaysia (Property). If you find this package useful, feel free to check out my portfolio for more information about me and my freelance services.
- Prerequisites
- Installation
- Usage
- Configuration
- CI/CD Integration
- Testing
- Contributing
- About the Author
- Laravel 9.x or higher
- PHP 7.3 or higher (Laravel 12 need to use PHP version 8.2 minimum)
- Install the package via Composer
composer require sulaimanmisri/easy-deploy- Run the installation wizard:
php artisan easy-deploy:installThat's it for the installation. Your application is ready to run the script.
php artisan easy-deploy:run- You can check the default commands in this page in this page
To add a custom command, edit the commands array in the easy-deploy.php config file:
'commands' => [
'php artisan migrate --force',
'php artisan cache:clear',
'your-custom-command',
],Simply add the command to your CI/CD pipeline script:
# GitHub Actions example
- name: Deploy Application
run: php artisan easy-deploy:run
# GitLab CI example
deploy:
script:
- php artisan easy-deploy:run
# Jenkins example
sh 'php artisan easy-deploy:run'This package comes with comprehensive tests to ensure reliability. To run the tests:
# Install dev dependencies first
composer install
# Run all tests
composer test
# Or run tests directly with PHPUnit
./vendor/bin/phpunitTests are organized into groups for better control:
# Run only core feature tests
./vendor/bin/phpunit --group=core
# Run only unit tests
./vendor/bin/phpunit tests/Unit/
# Run only feature tests
./vendor/bin/phpunit tests/Feature/Generate a detailed coverage report to see test coverage:
# Generate HTML coverage report
./vendor/bin/phpunit --coverage-html coverage
# View coverage report
open coverage/index.htmlThe package includes:
- Unit Tests: Test individual classes and methods
- Feature Tests: Test complete workflows and integrations
- Configuration Tests: Validate config file structure and defaults
- Command Tests: Test Artisan commands execution
When contributing to this package, please ensure:
- All new features have corresponding tests
- Tests follow the existing patterns using
#[Test]attributes - Feature tests are marked with
#[Group('core')] - Maintain 100% code coverage for new code
You can test your deployment configuration without running actual deployment:
# Test with empty commands (should show error message)
php artisan config:set easy-deploy.commands "[]"
php artisan easy-deploy:run
# Test with valid commands
php artisan config:set easy-deploy.commands '["php --version", "composer --version"]'
php artisan easy-deploy:run
# Reset to defaults
php artisan config:clearIf tests fail in your environment:
-
Check PHP version compatibility:
php --version # Should be 7.3+ for Laravel 9-11, 8.2+ for Laravel 12 -
Verify Composer dependencies:
composer validate composer install --no-dev --optimize-autoloader
-
Run specific failing test:
./vendor/bin/phpunit tests/Feature/DeploymentCommandTest.php --filter="deployment_command_executes_successfully" -
Clear any cached files:
php artisan config:clear php artisan cache:clear
We welcome contributions to Easy Deploy! Here's how you can help:
-
Fork and clone the repository:
git clone https://github.com/your-username/easy-deploy.git cd easy-deploy -
Install dependencies:
composer install
-
Run tests to ensure everything works:
composer test
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes and add tests:
- Add new features with corresponding tests
- Update existing tests if needed
- Ensure all tests pass
-
Follow coding standards:
- Use PSR-12 coding standard
- Add proper DocBlocks
- Use
#[Test]attributes for test methods - Mark feature tests with
#[Group('core')]
-
Submit a pull request:
- Provide a clear description of your changes
- Include any relevant issue numbers
- Make sure CI tests pass
If you find a bug or have a feature request:
- Check existing issues to avoid duplicates
- Provide detailed information:
- Laravel version
- PHP version
- Steps to reproduce
- Expected vs actual behavior
- Include relevant code samples if applicable
