- What is ebess/laravel-inertia-shared-data-provider used for?
- It is a Laravel package for sharing data with Inertia.js views through dedicated data provider classes. It helps keep controllers and middleware clean while making shared props reusable and testable across your application.
- How do I install ebess/laravel-inertia-shared-data-provider?
- Install it with Composer using composer require ebess/laravel-inertia-shared-data-provider. Then follow the package README for any registration or publishing steps and define your shared data providers. Check the README for the exact commands for your Laravel version.
- How is this package different from Inertia::share or middleware sharing?
- Inertia::share and middleware are built-in ways to share props, but the logic often lives inline in service providers or middleware. This package moves shared data into dedicated provider classes, making it more organized, reusable, and easier to test. For very small apps, the built-in options may still be sufficient.
- Which Laravel versions does this package support?
- Compatibility is defined by the package composer.json, including its Laravel and inertiajs/inertia-laravel constraints. Check those constraints against your application before installing. Because Laravel support changes over time, verify the latest release details on Packagist or GitHub.
- How do I create and register a shared data provider?
- You create a dedicated provider class that returns the props you want shared with Inertia views, then register it using the package's documented mechanism. The exact contract and registration syntax are in the README. Follow those instructions so the provider is resolved correctly by the package.
- Can I share authenticated user data or app settings with every Inertia page?
- Yes, common use cases include the authenticated user, notification counts, navigation menus, and application settings. Putting that logic in a provider gives every Inertia response consistent shared props. Keep the provider efficient because it runs during Inertia requests.
- Does it work with Vue, React, and Svelte Inertia frontends?
- Yes, the package works on the Laravel side and shares data through Inertia's prop system. The shared props are available whether your Inertia frontend uses Vue, React, or Svelte. It does not require a specific frontend adapter.
- How can I test shared Inertia data providers?
- Because providers are dedicated classes, you can instantiate them and assert the returned array directly. You can also use Laravel and Inertia testing helpers to make requests and assert the shared props. This testability is a main benefit over inline sharing logic.
- Are there performance concerns with shared data providers in production?
- The package itself is lightweight, but shared data is resolved on Inertia requests. Avoid expensive queries or heavy work inside providers, cache slow data where appropriate, and only share what pages actually need. Profile your app if you add many global props.
- Is ebess/laravel-inertia-shared-data-provider actively maintained?
- Review the GitHub repository for recent commits, releases, and open issues, and check Packagist for the latest version and constraints. Pin a tested version in composer.json for production use. Since maintenance activity can change, verify it before adopting the package for a long-term project.