TypeRocket / typerocket

TypeRocket is a highly integrated MVC WordPress framework with beautiful UI components for the modern developer.
https://typerocket.com
454 stars 62 forks source link

can i use typerocket for custom plugin development ? #249

Closed goigarg closed 2 years ago

goigarg commented 2 years ago

can i use typerocket for custom plugin development ?

str commented 2 years ago

+1

str commented 2 years ago

It looks like more people are trying to get the same results, but it seems there needs to be a lot of changes for this. See https://github.com/TypeRocket/typerocket/issues/209

kevindees commented 2 years ago

Hey @str @goigarg

You can use TypeRocket within a plugin as seen in the video here.

https://www.youtube.com/watch?v=q0fVxcszFng

If you are looking to include TypeRocket itself (all core files and assets) within a plugin it is not recommended because you can run into PHP function and class collisions. I recommend having TypeRocket installed as a plugin and then creating a separate plugin that uses the TypeRocket plugin.

str commented 2 years ago

@kevindees this is exactly what I was looking for.

Once you create a plugin via galaxy would you still need the typerocket installed as a mu-plugin? or would I be able to use the new custom plugin as a stand alone?

I liked the way we can easily install typerocket as a mu-plugin via composer create-project --prefer-dist typerocket/typerocket typerocket. Is there a way to create a new typerocket based plugin via composer?

And a last question, if I do need to install typerocket as a mu-plugin, is there a way to compser require it, like it is done for roots/bedrock?

str commented 2 years ago

Ohh and another question: when you define your namespace for the plugin, is it possible to have multiple levels? Like MyVendorName\Flights?

str commented 2 years ago

Ohhh but the make:plugin is only available in the pro-version, right?

kevindees commented 2 years ago

@str

  1. You can not create a TypeRocket plugin as "stand-alone" unless you embed it within your plugin using composer or a custom method. I do not have docs or tutorials for this as I can't do support for those types of installs (this is due to name collisions). Instead, I recommend just making TypeRocket a required/dependant plugin to use yours.
  2. There is no package for making a TypeRocket plugin with composer. But, that is a great idea I may implement down the road.
  3. You can do a root install with TypeRocket if you like (this will be closest to roots/bedrock). https://typerocket.com/docs/v5/install-via-composer/#section-install-typerocket-with-composer-2-2-root-install
  4. You can set your namespace as many levels deep as you like, just be sure your autoloader on includes can find the files.
  5. Correct, make:plugin is a pro-only feature.
str commented 2 years ago

@kevindees kevindees

I was able to create a new plugin via make:plugin, but it was not that easy.

Now I have 2 new issues:

kevindees commented 2 years ago

Hey @str

  1. The documentation here outlines how to add routes: https://typerocket.com/docs/v5/plugins-making/#section-core-plugin-class
  2. This video tutorial covers creating a galaxy cli configured for a custom plugin. Once the plugin is created using make:plugin you will need a custom galaxy cli to ensure the previous cli tool works as expected: https://www.youtube.com/watch?v=q0fVxcszFng
str commented 2 years ago

OK, I think we can close this issue now. Thank you.