Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

grant@clevyr.com's avatar

How to create a composer package for a Nova Resource

I am building a Nova Page Builder for our company but am new to creating composer packages. Here is what I have as far as files:

  • Models / Page.php (model)
  • Nova / Pages.php (handles fields for the model)
  • Migration file to build "pages" table
  • Requires other composer packages for things like nova-tabs, nova-menu, nova-flexible-fields.

I have this all working in a Nova project but we are wanting to turn this into a composer package that can be installed in other projects. I can think of 3 ways to do this.

  1. Create a custom Nova tool (I don't want to have to do all of this unless necessary, creating custom Vue components for default Nova behavior seems like overkill)
  2. Publish the above files to the app/database directories using Composer and run the migrations
  3. Somehow link the vendor/ files for this package to the local app instance? I'm not even sure if this doable.

It would be nice if we could just include a service provider and it would all work, is that possible without creating a custom Nova tool?

Any advice on which route to go down?

0 likes
1 reply
laracoft's avatar

@grant@clevyr.com

I think it's better to focus on creating a Laravel package, as a composer package won't have everything that Laravel packages needs to have.

You can setup a Laravel package skeleton easily using https://github.com/Jeroen-G/laravel-packager

Next would be to setup similar folders in the package, i.e. app/Models will become vendor/package/src/Models, you will have to modify their namespaces etc

There is also this part about registering your resources https://nova.laravel.com/docs/3.0/resources/#registering-resources

If you are using things like livewire etc, that has to be registered too.

For migration, you have to register the folder $this->loadMigrationsFrom($folder);

As for other composer packages, just add them to your new package's composer.json

Registration is probably the trickiest part if you are new to creating packages.

I think you should be able to handle the rest with no issues.

Hope your page builder will be an open source one. :)

Please or to participate in this conversation.