Hi

I'm trying to switch from PHPStorm and Laravel Idea plugin for PhpStorm.
I'm try to limit the number of extension that I install.

Is there a list of 'recommended' or needed extensions or tools one need to install.

E.g. out of the box PHPTools cannot - or I have not found the correct settings

Autocomplete on e.g Models, it cannot 'goto - view', or 'create view', if the view does not exists, cannot format using Laravel Pint standard, cannot auto complete route and views, cannot autocomplete blade components, cannot create Factory classes for models, cannot create a PhpUnit / Pest test.

I'm most likely missing some 'things' I'm used to have in PhPStorm.

Please, this is not a complaint, but more a ask for help to get VS code up and running for Laravel development.

Any suggestions is highly appreciated.

Thanks

    rabol Thank you for the suggestions.

    PHPTools is not yet a full replacement for the Laravel plugin.

    • Laravel code formatting is supported - please see the php.format.codeStyle setting:

      Is there anything we should add or improve? How does the Laravel Pint formatting differ?
    • Autocomplete on eloquent models should be supported. We recognize models, services, facades, .. and suggest completions accordingly. Please let us know if there is anything we don't do properly.

    Not Implemented - work in progress:

    • "goto view" or "create view" is not implemented - good point.
    • creating tests is not implemented.
    • autocomplete for routes not implemented.
    • autocomplete for components in blade files not implemented.

      Hi

      I'm not sure how I can test to see the all the differences between PHPTools Laravel formatting and Laravel Pint, but Laravel pint is installed by default in any new app.

      One thing is this: (php format->Laravel)

      if ($request->user()->isDirty('email'))
      {
          $request->user()->email_verified_at = null;
      }

      now formatted with pint

      if ($request->user()->isDirty('email')) {
              $request->user()->email_verified_at = null;
          }

      I really miss the 'Create view' and goto view (I have found a extension for goto view)
      Also the generation of factory and pest/phpunit is a big miss

      Not sure what I am missing, but model autocompleting is not working.

      have a look at this where I fetch a model

      I do not have any property called namespace, null or user_name on the model.

      Laravel Idea have function to generate helper code, I do not see that in PHPTools - Sure I can install the ide-helper package, but the PHPTools installation does not mention that it needs any helper packages :)

      I also REALLY miss the auto import of classes.

      Also auto complete of blade or livewire components i really missed

        rabol Thank you for the details!

        • Formatting: please make sure you set Format: Code Style to "Laravel"

        • Features: Create View, GoTo View, Generating Factory and tests, ...
          Working on it, thanks for the suggestions!

        • IntelliSense: what version of Laravel do you use? I've noticed versions <= 8 have poor annotations. With Laravel >= 9, you should see the following data tool tips:

          • Tooltip on ::first() should properly recognize that it's returning User
          • After -> you should see all the methods from traits, mixins, and eloquent extensions.
        • ide helper is not needed as you mentioned :) but it may add some annotations for older Laravel framework sources.

        • auto import classes is there; it auto-imports when typing, or it can be invoked using a code action, or a quick fix:

          I can see, if you just type "User", it does not auto-import. VSCode needs you to select the corresponding item in the code completion - I'll see if we can improve that behavior.



          Quick fix is available, but note it's a premium feature.

          Hi

          Thanks for the formatting hint - I actually thought that I had it to Laravel, but it was on PSR-12, my mistake
          I normally always work with the latest version of Laravel, so currently V11
          I have a paid version of PHPTools, so I assume that "Premium" features is included
          I might try to switch to pre-release vesions of PHP Tools to get the "missing" features faster :)

            rabol good! We'll be continuously pushing new features to pre-release.

            May I ask you to check the tooltip for User::first() ?

              6 months later

              @rabol Hello,

              We have several exciting updates about Laravel support in VS Code.

              Pre-Release 1.55.16833 provides most of the Laravel magic, various code completions, routes, views, configs, Livewire, Blade editor, Eloquent magic, and more.

              Please try and let us know how it works for you. We're keen to add more features or improve existing.

              Anything specific one should try to test ?

              • Edited

              I have noticed that the config() lookup only goes one level down

              e.g

              in the config/services.php one can have something like this:

              'my_service' => [
                  'api_key => 'sdjhsakhdkjshdkjahkdah'
              ]

              then the lookup only show services.my_service and not services.my_service.api_key

              as you can see, there is only one level

              As far as I can see, there should be support for formatting blade files, but I cannot make it work.
              Is there a setting that I'm missing ?

                rabol Formatting blade files is there:

                May I ask for an example, where it doesn't work as expected?

                  I'm not allowed to upload QTVideo - what is supported ?

                    rabol please try .mov again (it was disabled for some reason). Otherwise, a link somewhere will always work.

                    thank you

                      Write a Reply...