rawilk / laravel-form-components

Form components built for Tailwind & Livewire.
https://randallwilk.dev/docs/laravel-form-components
MIT License
386 stars 42 forks source link

Cannot install, possibly due to name conflict #55

Closed andrecuellar closed 2 years ago

andrecuellar commented 2 years ago

Laravel Form Components Version

v7.1.3

Laravel Version

v9.2

Alpine Version

v3.0.6

Bug description

Currently, I have the "protonemedia/laravel-form-components" library installed: "^3.6" in my componser.json.

I have tried to install also the "rawilk/laravel-form-components" library: "^7.1.3" without success, I get an error in the console and I suspect it might be due to the same name of both libraries

the error while autoloading is:

Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   Error

  Call to undefined method ProtoneMedia\LaravelFormComponents\Components\Form::assets()

it seems to me that due to the similarity of the name, is logging the wrong class

Call to undefined method ProtoneMedia\LaravelFormComponents\Components\Form::assets()

Steps to reproduce

  1. Add "protonemedia/laravel-form-components": "^3.6", to composer.json file in "require" section
  2. Run composer install
  3. Add "rawilk/laravel-form-components" library: "^7.1.3" to composer.json file in "require" section or run composer require rawilk/laravel-form-components in console
  4. Get the error

Relevant log output

Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   Error

  Call to undefined method ProtoneMedia\LaravelFormComponents\Components\Form::assets()

  at C:\laragon\www\new-tabimuse\vendor\rawilk\laravel-form-components\src\FormComponentsServiceProvider.php:127
    123▕         if (! class_exists($component)) {
    124▕             return;
    125▕         }
    126▕
  ➜ 127▕         foreach ($component::assets() as $asset) {
    128▕             $files = (array) ($assets[$asset] ?? []);
    129▕
    130▕             collect($files)->filter(function (string $file) {
    131▕                 return Str::endsWith($file, '.css');

  1   C:\laragon\www\new-tabimuse\vendor\rawilk\laravel-form-components\src\FormComponentsServiceProvider.php:63
      Rawilk\FormComponents\FormComponentsServiceProvider::registerAssets("ProtoneMedia\LaravelFormComponents\Components\Form", ["https://unpkg.com/alpinejs@3.9.3/dist/cdn.min.js", "https://unpkg.com/@popperjs/core@2"])

  2   C:\laragon\www\new-tabimuse\vendor\laravel\framework\src\Illuminate\Support\ServiceProvider.php:266
      Rawilk\FormComponents\FormComponentsServiceProvider::Rawilk\FormComponents\{closure}(Object(Illuminate\View\Compilers\BladeCompiler), Object(Illuminate\Foundation\Application))
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Installation failed, reverting ./composer.json and ./composer.lock to their original content.