- How do I install cross-solution/bootstrap3-dialog in my Laravel project?
- Run `composer require cross-solution/bootstrap3-dialog` to install the package. Ensure Bootstrap 3’s CSS and JS are already loaded in your project (this is a hard requirement). No additional Laravel service provider setup is needed—just include the package’s JS file in your layout.
- Does this package work with Laravel 5.x or only newer versions?
- The package is designed for Laravel 5.x and older projects still using Bootstrap 3. While it may work in newer Laravel versions, it lacks native integration with Laravel’s modern features (e.g., Blade directives, service providers). Test thoroughly if using Laravel 6+.
- Can I use this for dynamic modals with AJAX content?
- Yes, the package supports dynamic content by allowing you to initialize modals via JavaScript after AJAX calls. You’ll need to manually trigger the dialog using the package’s API (e.g., `new Bootstrap3Dialog('#modal-id')`) after loading content via fetch or jQuery.
- Will this conflict with Bootstrap 4/5 or custom modal solutions?
- Yes, this package is **Bootstrap 3-only** and may conflict with Bootstrap 4/5 or custom modal CSS/JS. To mitigate risks, isolate the package’s scope by using unique class prefixes or loading it in a micro-namespace (e.g., a specific partial view).
- Is there Blade directive support (e.g., @dialog) like other Laravel packages?
- No, this package does not include Blade directives. You’ll need to manually include modal HTML in your views and initialize them via JavaScript. For Blade-like syntax, consider wrapping the HTML in a custom Blade component or macro.
- How do I configure global settings like default titles or button styles?
- The package provides a centralized configuration via JavaScript. Set defaults in your layout file (e.g., `window.Bootstrap3DialogConfig = { title: 'Alert', buttons: ['OK'] }`) before initializing any modals. This avoids repeating markup across views.
- Can I use this with Livewire or Inertia.js in Laravel?
- No, this package is **not compatible** with Livewire or Inertia.js. Modals in those frameworks should be handled by the frontend framework’s native solutions (e.g., Alpine.js, Vue, or React components). This package is for vanilla Laravel apps with server-rendered HTML.
- What if I need to upgrade from Bootstrap 3 to Bootstrap 5 later?
- Plan for a full migration away from this package, as it has no Bootstrap 5 support. Start by auditing all modal usage in your app and replace this package with a Bootstrap 5-compatible solution (e.g., a custom modal component or a package like `laravel-bootstrap-modal` for Bootstrap 5).
- Are there alternatives for Laravel that support Bootstrap 5 or modern frameworks?
- Yes, consider alternatives like `spatie/laravel-modal` (for Bootstrap 5), `filamentphp/filament` (for admin panels), or frontend frameworks like Alpine.js, Livewire, or Inertia.js for dynamic modals. These offer better Laravel integration and future-proofing.
- How do I test modals created with this package in PHPUnit?
- Since the package is client-side only, test it by simulating modal triggers in your JavaScript tests (e.g., Jest or Karma). For Laravel, mock the modal initialization in Blade views and verify the rendered HTML structure. Use tools like `laravel/browser-kit-testing` to check if modal elements exist in the DOM.