sulaimanmisri / easy-deploy
A simple Laravel package to simplify deployment commands
Requires
- php: ^7.3|^8.0
- laravel/framework: ^9.0|^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^7.0|^8.0|^9.0
- phpunit/phpunit: ^9.0|^10.0
This package is auto-updated.
Last update: 2025-08-04 10:13:06 UTC
README
Easy Deploy for Laravel Application
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
About the Author
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.
Table of Contents
- Prerequisites
- Installation
- Usage
- Configuration
- CI/CD Integration
- Testing
- Contributing
- About the Author
Prerequisites
- Laravel 9.x or higher
- PHP 7.3 or higher (Laravel 12 need to use PHP version 8.2 minimum)
Installation
- Install the package via Composer
composer require sulaimanmisri/easy-deploy
- Run the installation wizard:
php artisan easy-deploy:install
That's it for the installation. Your application is ready to run the script.
Usage
Run the deployment automation command:
php artisan easy-deploy:run
Configuration
"What kind of command does this package run for me?"
- You can check the default commands in this page in this page
Adding a custom command
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', ],
CI/CD Integration
Example Integration with CI/CD Pipelines
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'
Testing
Running Tests
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/phpunit
Test Groups
Tests 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/
Coverage Report
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.html
Test Structure
The 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
Contributing Tests
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
Testing Your Configuration
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:clear
Debugging Failed Tests
If 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
Contributing
We welcome contributions to Easy Deploy! Here's how you can help:
Development Setup
-
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
Making Changes
-
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
Reporting Issues
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