nova-kit/nova-packages-tool
Deprecated tool for developing Laravel Nova packages. Functionality has moved to laravel/nova-devtool; use that package instead. Links to Packagist and version/download badges are included, but this repo is no longer the recommended option.
Installation Add the package via Composer:
composer require nova-kit/nova-packages-tool --dev
Publish the config file (if needed):
php artisan vendor:publish --provider="NovaKit\NovaPackagesTool\NovaPackagesToolServiceProvider" --tag="config"
Basic Usage Run the tool to scaffold a new Nova package:
php artisan nova:package create MyPackage
This generates:
packages/ directory with your package structure.composer.json for your package.package.json, resources/js, src/).First Integration
Register your package in config/nova.php under the packages key:
'packages' => [
NovaKit\NovaPackagesTool\NovaPackagesTool::class,
Nova\NovaServiceProvider::class,
// Add your package's service provider
MyVendor\MyPackage\MyPackageServiceProvider::class,
],
Scaffolding a Package
Use the nova:package command to generate a new package with:
php artisan nova:package:create MyPackage --with-resources --with-tests
--with-resources: Includes Vue/React/Inertia resources.--with-tests: Adds PHPUnit/Pest test boilerplate.Adding a Nova Resource Generate a Nova resource inside your package:
php artisan nova:package:resource Post --package=MyPackage
This creates:
src/Resources/Post.phpresources/js/resources/Post.jsTooling for Development
nova:package watch to auto-reload assets during development.php artisan nova:package test to execute package-specific tests.Integration with Nova Extend Nova’s functionality by:
Nova::serving() in your package’s service provider.Nova::extend() or middleware.MyPackageServiceProvider.webpack.mix.js for your package’s frontend assets.Nova::tools() to add custom tools or modify existing ones.publishes in your service provider to expose package settings.Asset Loading Conflicts
webpack.mix.js:
mix.js('resources/js/package.js', 'dist/js')
.vue()
.postCss('resources/css/package.css', 'dist/css', []);
dist/js/my-package.js) to avoid collisions.Namespace Collisions
MyVendor\MyPackage\Resources\Post).Nova as a namespace prefix for your package classes.Testing Quirks
$this->app->instance(Nova::class, new class extends Nova {
public function tool($name) { return null; }
});
--package=MyPackage flag for package-specific test commands.Configuration Overrides
mergeConfigFrom in your service provider:
$this->mergeConfigFrom(__DIR__.'/../config/my-package.php', 'nova.my-package');
php artisan nova:package assets:compile --package=MyPackage
Route::get('/nova/vendor/my-package/debug', function () {
return response()->json(Route::getRoutes()->getByName('nova'));
});
nova:package watch and check browser console for errors.php artisan nova:package:command create MyCommand --package=MyPackage
$this->publishes([
__DIR__.'/templates/' => resource_path('nova-packages-tool/templates'),
]);
Nova::tools([MyPackageTool::class]);
class MyPackageTool extends Tool
{
public function boot()
{
Nova::serving([$this, 'serveAssets']);
}
}
How can I help you explore Laravel packages today?