jeudi 24 novembre 2016

How to access a packages methods?

I'm developing a laravel package, inside the package I have a repository that deals with the data.

When a user installs the package, how can I get them to interact with the repository in their app?

Should I set up a facade so they can do something like:

SuperPackage::getSomeData();

Or should I use a different way?

The docs state:

When building a third-party package that interacts with Laravel, it's better to inject Laravel contracts instead of using facades. Since packages are built outside of Laravel itself, you will not have access to Laravel's facade testing helpers.

I presume this is just meant for internals of the package, calling the package externally, facades are still ok?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire