Remove the Package Reference
Open the composer.json File:
- Locate the require section in the composer.json file and remove the entry for the w3speedster/w3speedster package.
- Delete the above line, ensuring the JSON remains valid.
"require": {
"w3speedster/w3speedster": "1.0.0",
...
}
Remove the Repository Entry:
If the repositories section contains an entry for the w3speedster/w3speedster package, remove it as well:
"repositories": [
{
"type": "path",
"url": "packages/w3speedster/w3speedster"
}
]
Uninstall the Package
Run the following Composer command to remove the package from your project:
composer remove w3speedster/w3speedster
This command:
- Removes the package files from your project.
- Updates the composer.lock file to reflect the changes.
Clean Up Laravel Configuration
Remove Published Files:
If the package published configuration or assets files during installation, remove them manually. Check the config/ folder for a configuration file named w3speedster.php (or similar) and delete it:
rm config/w3speedster.php
Rollback Migrations (if applicable):
- If the package added database migrations, run the following command to roll them back
- If you’re unsure which migrations belong to the package, check the database/migrations directory and remove any files that were added by the package.
php artisan migrate:rollback
Clear Cached Configurations:
Clear the application cache to ensure Laravel no longer references the package:
php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear
Remove Package Files
Delete the Package Directory:
Navigate to the packages folder and remove the w3speedster directory
rm -rf packages/w3speedster
Verify Autoload Files:
Refresh Composer’s autoload files to ensure the package is completely removed from the autoloader:
composer dump-autoload
Verify Uninstallation
Check for Artifacts:
Run the php artisan command to confirm that any Artisan commands related to the w3speedster package are no longer available.
Test the Application:
- Verify that your Laravel project runs without errors.
- Ensure no references to the w3speedster package remain in your codebase.