Installation
System Requirements
Minimum Requirements
- PHP: 8.1 or higher
- Laravel: 9.x, 10.x, 11.x, or 12.x
- Composer: 2.0 or higher
- Memory: 512MB minimum (1GB recommended for large projects)
- Disk Space: 50MB for package + cache
Recommended Requirements
- PHP: 8.2 or higher
- Extensions:
ext-json,ext-mbstring,ext-tokenizer - Memory: 1GB or higher
- OPcache: Enabled for better performance
Compatibility Matrix
| Laravel Version | PHP Version | ShieldCI Support |
|---|---|---|
| Laravel 12.x | PHP 8.2+ | ✅ Full Support |
| Laravel 11.x | PHP 8.2+ | ✅ Full Support |
| Laravel 10.x | PHP 8.1+ | ✅ Full Support |
| Laravel 9.x | PHP 8.1+ | ✅ Full Support |
Installation Methods
Method 1: Composer (Recommended)
Install ShieldCI:
composer require shieldci/laravelVerify Installation:
php artisan shield:analyzeThis will run the analysis and show the ShieldCI version in the output.
Method 2: Global Installation
Install ShieldCI globally for use across multiple projects:
composer global require shieldci/laravelAdd to PATH (if not already):
# Add to ~/.bashrc or ~/.zshrc
export PATH="$HOME/.composer/vendor/bin:$PATH"Run from any Laravel project:
cd /path/to/your/laravel/app
php artisan shield:analyzeMethod 3: Docker
Use ShieldCI in a Docker container:
# Pull official image
docker pull shieldci/laravel:latest
# Run analysis
docker run --rm -v $(pwd):/app shieldci/laravel:latest php artisan shield:analyzeDocker Compose Integration:
# docker-compose.yml
services:
shieldci:
image: shieldci/laravel:latest
volumes:
- .:/app
command: php artisan shield:analyzeRun analysis:
docker-compose run --rm shieldciPost-Installation Setup
Step 1: Publish Configuration (Optional)
Generate a configuration file to customize analyzer behavior:
php artisan vendor:publish --tag=shieldci-configThis creates config/shieldci.php with default settings.
Step 2: Verify Installation
Run your first analysis to verify installation:
php artisan shield:analyzeThis will run all analyzers and show you the results. If you see the analysis report, ShieldCI is installed correctly.
Step 3: Run First Analysis
Perform your first security and quality scan:
php artisan shield:analyzeThis will:
- Discover your Laravel project structure
- Parse PHP files into ASTs
- Run all analyzers
- Generate a detailed report
Expected duration: 30-60 seconds for typical Laravel apps
See First Analysis for detailed walkthrough.
Installation Troubleshooting
Issue: Composer Install Fails
Error:
Your requirements could not be resolved to an installable set of packages.Solutions:
Update Composer dependencies:
bashcomposer update shieldci/laravel --with-all-dependenciesCheck PHP version:
bashphp -v # Must be 8.1+Clear Composer cache:
bashcomposer clear-cache composer install
Issue: Command Not Found
Error:
php artisan shield:analyze
# Command "shield:analyze" is not defined.Solutions:
Clear Laravel cache:
bashphp artisan config:clear php artisan cache:clear php artisan optimize:clearVerify package is in composer.json:
bashcomposer show shieldci/laravelReinstall package:
bashcomposer remove shieldci/laravel composer require shieldci/laravel
Issue: Memory Limit Exceeded
Error:
PHP Fatal error: Allowed memory size of 134217728 bytes exhaustedSolutions:
Increase PHP memory limit (temporary):
bashphp -d memory_limit=512M artisan shield:analyzeUpdate php.ini (permanent):
inimemory_limit = 512MExclude large directories:
php// config/shieldci.php 'excluded_paths' => [ 'vendor/*', 'node_modules/*', 'storage/*', 'public/build/*', // Add large build directories ],
Issue: Parse Errors in Legacy Code
Error:
Parse error: syntax error, unexpected token "match" in OldController.phpSolutions:
Exclude problematic files:
php// config/shieldci.php 'excluded_paths' => [ 'vendor/*', 'app/Legacy/**', // Exclude legacy code ],Update PHP version:
bash# ShieldCI requires PHP 8.1+ for modern syntax php -v
Issue: Slow Analysis Performance
Symptoms: Analysis takes 5+ minutes
Solutions:
Enable OPcache:
ini; php.ini opcache.enable=1 opcache.enable_cli=1Reduce analyzed paths:
php// config/shieldci.php 'paths' => [ 'analyze' => [ 'app/Http', // Only analyze critical paths 'app/Models', 'routes', ], ],
Upgrading
From Previous ShieldCI Versions
# Update to latest version
composer update shieldci/laravel
# Clear caches
php artisan config:clear
php artisan cache:clear
# Republish config (if needed)
php artisan vendor:publish --tag=shieldci-config --forceBreaking changes: See CHANGELOG.md
Uninstallation
Remove ShieldCI completely:
# 1. Remove package
composer remove shieldci/laravel
# 2. Delete configuration (optional)
rm config/shieldci.php
# 3. Clear caches
php artisan config:clear
php artisan cache:clearNext Steps
- First Analysis - Run your first security scan
- Configuration - Customize analyzer behavior
Getting Help
- Documentation: docs.shieldci.com
- GitHub Issues: github.com/shieldci/laravel/issues