Skip to content

[11.x] Allow exceptions to the optimize and optimize:clear commands - #54070

Merged
taylorotwell merged 4 commits into
laravel:11.xfrom
jonerickson:feature/optimize-except
Jan 9, 2025
Merged

[11.x] Allow exceptions to the optimize and optimize:clear commands#54070
taylorotwell merged 4 commits into
laravel:11.xfrom
jonerickson:feature/optimize-except

Conversation

@jonerickson

Copy link
Copy Markdown
Contributor

Summary

This PR introduces the --except option to the optimize and optimize:clear commands, enabling greater flexibility in managing optimization tasks. This change allows developers to integrate with these commands while providing control over which specific tasks are executed or skipped.

Use Case

In applications deployed on Laravel Vapor, route caching is unsupported. By leveraging the --except option, we can utilize the optimize command without triggering unsupported operations like route:cache.

Examples

// Skip by command name
php artisan optimize --except route:cache

 // Skip by key
php artisan optimize --except route

// Skip by comma delimited list of keys or command names
php artisan optimize:clear --except route,view:cache

New Help

Screenshot 2025-01-03 at 9 09 16 AM

Feedback

Welcome to input on strategy or additional use cases this feature could support.

@jonerickson
jonerickson marked this pull request as draft January 3, 2025 17:16
@github-actions

github-actions Bot commented Jan 3, 2025

Copy link
Copy Markdown

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@jonerickson
jonerickson marked this pull request as ready for review January 8, 2025 06:23
@jonerickson jonerickson changed the title Allow exceptions to the optimize and optimize:clear commands [11.x] Allow exceptions to the optimize and optimize:clear commands Jan 8, 2025
@shaedrich

Copy link
Copy Markdown
Contributor

Would be nice if it worked both ways by also adding --only 🤔

@jonerickson

Copy link
Copy Markdown
Contributor Author

Would be nice if it worked both ways by also adding --only 🤔

Thought about it. More than happy to added it! Just didn't want to bloat it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants