How can you write exceptions without forcing Ignition to be installed? #466
Replies: 3 comments 1 reply
-
@AlexVanderbist @freekmurze I'd be happy to contribute a PR to make this possible again, but of course there's no way for me to PR the creation of a new spatie package. 😅 |
Beta Was this translation helpful? Give feedback.
-
Hi, that's a good point! I wonder if a subtree split of the contracts namespace would be a good solution. Similar to how Laravel published their I'll try to look into this later this week, as you said; it's quite impossible to PR a new repo :p |
Beta Was this translation helpful? Give feedback.
-
We realized that requiring The |
Beta Was this translation helpful? Give feedback.
-
In a package, how can you write an exception that implements
ProvidesSolutions
without requiring Ignition?For example, in a Laravel package, I could have an exception like this:
Without Ignition installed, you get
Error: Interface "Spatie\Ignition\Contracts\ProvidesSolution" not found
.We can fix that by requiring Ignition in the package, but that means we're forcing it onto people's projects.
In the past, we could just require the
ignition-contracts
package which prevents our error, and allows users to avoid installing Ignition itself if they don't want it. However, when you changed over thespatie
namespace, you merged that package into this one. See #8I obviously love Ignition and would recommend always using it, but maybe people had their reasons for avoiding it. They could simply remove it from their composer.json.
Beta Was this translation helpful? Give feedback.
All reactions