Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining console commands #18

Open
Jaspervv opened this issue Feb 14, 2019 · 3 comments
Open

Defining console commands #18

Jaspervv opened this issue Feb 14, 2019 · 3 comments

Comments

@Jaspervv
Copy link

Jaspervv commented Feb 14, 2019

Is it possible to define console commands from within a plugin? And if so.. how?

The only way made this possible was by editing the themosis/themosis's App\Console\Kernel. But I would like the plugin to work independently.

@jlambe
Copy link
Contributor

jlambe commented Feb 15, 2019

@Jaspervv Normally you should have access to the Command alias which lets you call commands defined from the root application.

Now for defining commands, I haven't extended the plugin manager for this but this can actually be a great feature addition. So yes, for now I think you can't define commands from the plugin.

@Jaspervv
Copy link
Author

Jaspervv commented Mar 12, 2019

Thanks, I checked and calling commands can be done with

Console::call('key:generate');

For anyone coming across this in the future, be sure to check Laravel's Documentation.


Implementing commands support for plugins requires more than I thought, php console never initialises WordPress, therefor plugins and the PluginLoader are never initialised either.

@jlambe
Copy link
Contributor

jlambe commented Mar 12, 2019

The idea with plugin commands would be to be able to register commands within the application without having to load WordPress. WordPress will always try to look after a database and for running commands, it is not necessary.

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

No branches or pull requests

2 participants