Coder Social home page Coder Social logo

psalm-plugin-laravel's Introduction

Psalm plugin for Laravel

The package is seeking maintainers

โš ๏ธ This is a perfect opportunity to learn Laravel very deep and collaborate with other high-skilled developers. At this moment, the package is maintained almost solely by @alies-dev, and he is looking for developers to build a team who can constantly improve this package and the whole Psalm ecosystem.

Some ideas to implement:

  • Fully support custom Model Query Builders (medium)
  • Add an option to rely on Model @property declarations only
  • Get rid of barryvdh/laravel-ide-helper dependency and be more accurate with attribute types
  • Support .sql files for migrations (to find information about attributes and their types)

Packagist version Packagist downloads Type coverage Tests Tests

Overview

This Psalm plugin brings static analysis and type support to projects using Laravel. Our goal is to find as many type-related bugs as possible, therefore increasing developer productivity and application health. Find bugs without the overhead of writing tests!

Screenshot

Versions & Dependencies

Maintained versions:

Laravel Psalm Plugin PHP Laravel Psalm
master ^8.1 10, 11 5
2.9.x ^8.0 9, 10, 11 4, 5
1.6.x >=7.3 6, 8 4
1.4.x >=7.2 6, 7, 8 3, 4

See releases for more details about supported PHP, Laravel and Psalm versions.

Quickstart

Step 1: Install

composer require --dev psalm/plugin-laravel

Step 2: Configure

If you didn't use Psalm on the project before, you need to create a Psalm config:

./vendor/bin/psalm --init

Step 3: enable the plugin:

./vendor/bin/psalm-plugin enable psalm/plugin-laravel

Step 4: Run ๐Ÿš€

Run your usual Psalm command:

./vendor/bin/psalm

You can customize Psalm configuration using XML config and/or cli parameters.

Recommendation: use baseline file and increase errorLevel at least to 4: this way you can catch more issues. Step by step set errorLevel to 1 and use Psalm and this plugin at full power ๐Ÿš€.

How it works

Under the hood it just runs https://github.com/barryvdh/laravel-ide-helper and feeds the resultant stubs into Psalm, which can read PhpStorm meta stubs.

It also parses any database migrations it can find to try to understand property types in your database models.

Psalm-Laravel-Plugin or Larastan?

Both! It's fine to use both tools at the same project: they use different approaches to analyze code, and thus you can find more bugs! Psalm and PHPStan use almost same the syntax annotations, so you should not have any conflicts.

psalm-plugin-laravel's People

Contributors

alies-dev avatar mr-feek avatar lptn avatar muglug avatar nielsvanpach avatar caugner avatar github-actions[bot] avatar mzur avatar ronb-lendesk avatar actions-user avatar tm1000 avatar asbiin avatar danog avatar dependabot[bot] avatar crynobone avatar pthiers avatar tjmmm avatar hendrikheil avatar yaegassy avatar masterfermin02 avatar siebeve avatar eithed avatar legion112 avatar netcode avatar dpash avatar brendt avatar twistor avatar ekvedaras avatar ctf0 avatar pro2s avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.