- What is opscale-co/nova-api used for?
- It is a Laravel package that adds default secured CRUD API endpoints for your Nova resources. It helps expose Nova resources and actions through REST endpoints, with authentication and JSON responses. It is intended for Laravel applications that already use Laravel Nova and want an API layer for their admin resources.
- How do I install opscale-co/nova-api with Composer?
- Install it with Composer using composer require opscale-co/nova-api. Then follow the package setup steps in the repository README, including any service provider or configuration publishing required. Check the Composer constraints to ensure your Laravel and Nova versions are supported.
- Does opscale-co/nova-api support Laravel Nova 4?
- The package is built for Laravel Nova, but exact Nova version support depends on its Composer requirements. Check the composer.json and README on the repository for the supported nova and laravel constraints. If you are on Nova 4, verify compatibility before adding it to a production application.
- How does authentication work in nova-api?
- The package adds secured CRUD API endpoints and supports authentication for the exposed REST routes. You should configure the route middleware and guards according to the package documentation so endpoints are protected in production. Review the published routes or config to confirm which auth middleware is applied.
- How do I expose a Nova resource through the API?
- You register or reference your Nova resource so the package can generate default CRUD REST endpoints for it. The exact registration method is described in the README, and it typically involves route or config definitions. The endpoints return JSON responses based on your Nova resource setup.
- Can I use Nova actions through the API?
- Yes, the package is described as exposing Nova resources and actions through REST endpoints. Actions can be made available through API routes, subject to the authentication setup you configure. Check the package docs for how to register actions and which routes are generated.
- How do I customize the API routes or endpoints?
- Route customization depends on the package's route and configuration publishing options. Look for route registration instructions or a config file in the repository README. You can usually adjust middleware, prefixes, and exposed resources through configuration, but verify the exact options in the package source.
- Is nova-api compatible with Laravel Sanctum or Passport?
- Because it is a Laravel package with authentication support, it should work with Laravel auth middleware and guards such as Sanctum or Passport. You would apply the appropriate middleware to the package routes. Confirm the recommended setup in the package documentation, since it may provide its own auth defaults.
- How can I test nova-api endpoints?
- Use Laravel's HTTP testing helpers to call the generated REST endpoints with authenticated users. Write feature tests for CRUD routes and action routes, and assert the JSON response structure. Check the package repository for existing tests or examples you can adapt.
- What are alternatives to opscale-co/nova-api?
- Alternatives include building custom API controllers and Laravel resources yourself or using another Nova API package. The right choice depends on whether you need default CRUD endpoints, Nova action support, and authentication out of the box. Compare maintenance activity and Laravel and Nova version compatibility before deciding.