All Projects → nunomaduro → Larastan

nunomaduro / Larastan

Licence: mit
⚗️ Adds code analysis to Laravel improving developer productivity and code quality.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to Larastan

Spotbugs
SpotBugs is FindBugs' successor. A tool for static analysis to look for bugs in Java code.
Stars: ✭ 2,569 (-27.72%)
Mutual labels:  static-analysis, hacktoberfest, static-code-analysis, code-analysis
Abaplint
Standalone linter for ABAP
Stars: ✭ 111 (-96.88%)
Mutual labels:  static-analysis, hacktoberfest, static-code-analysis
Revive
🔥 ~6x faster, stricter, configurable, extensible, and beautiful drop-in replacement for golint
Stars: ✭ 3,139 (-11.68%)
Mutual labels:  static-analysis, hacktoberfest, static-code-analysis
Codeclimate
Code Climate CLI
Stars: ✭ 2,273 (-36.04%)
Mutual labels:  static-analysis, hacktoberfest, static-code-analysis
Forbidden Apis
Policeman's Forbidden API Checker
Stars: ✭ 216 (-93.92%)
Mutual labels:  static-analysis, static-code-analysis, code-analysis
Pmd
An extensible multilanguage static code analyzer.
Stars: ✭ 3,667 (+3.18%)
Mutual labels:  static-analysis, static-code-analysis, code-analysis
Phpstan
PHP Static Analysis Tool - discover bugs in your code without running it!
Stars: ✭ 10,534 (+196.4%)
Mutual labels:  static-analysis, static-code-analysis, phpstan
Find Sec Bugs
The SpotBugs plugin for security audits of Java web applications and Android applications. (Also work with Kotlin, Groovy and Scala projects)
Stars: ✭ 1,748 (-50.82%)
Mutual labels:  static-analysis, hacktoberfest, code-analysis
Nebula
Nebula is a minimalistic and easy to use administration tool for Laravel applications, made with Laravel, Alpine.js, and Tailwind CSS.
Stars: ✭ 190 (-94.65%)
Mutual labels:  hacktoberfest, laravel
Multi Tenant
Run multiple websites using the same Laravel installation while keeping tenant specific data separated for fully independent multi-domain setups, previously github.com/hyn/multi-tenant
Stars: ✭ 2,304 (-35.17%)
Mutual labels:  hacktoberfest, laravel
Icalendar Generator
Generate calendars in the iCalendar format
Stars: ✭ 193 (-94.57%)
Mutual labels:  hacktoberfest, laravel
Media Manager
A simple file browser and up-loader for Laravel written in Vue.JS
Stars: ✭ 190 (-94.65%)
Mutual labels:  hacktoberfest, laravel
Checkov
Prevent cloud misconfigurations during build-time for Terraform, Cloudformation, Kubernetes, Serverless framework and other infrastructure-as-code-languages with Checkov by Bridgecrew.
Stars: ✭ 3,572 (+0.51%)
Mutual labels:  static-analysis, hacktoberfest
Librenms
Community-based GPL-licensed network monitoring system
Stars: ✭ 2,567 (-27.77%)
Mutual labels:  hacktoberfest, laravel
Laravel Surveillance
Put malicious users, IP addresses and anonymous browser fingerprints under surveillance, log the URLs they visit and block malicious ones from accessing the Laravel app.
Stars: ✭ 198 (-94.43%)
Mutual labels:  hacktoberfest, laravel
Laravel Datatables Buttons
jQuery DataTables Buttons Plugin for Laravel.
Stars: ✭ 192 (-94.6%)
Mutual labels:  hacktoberfest, laravel
Laravel Datatables Html
Laravel DataTables HTML Builder Plugin
Stars: ✭ 188 (-94.71%)
Mutual labels:  hacktoberfest, laravel
Monica
Personal CRM. Remember everything about your friends, family and business relationships.
Stars: ✭ 15,499 (+336.1%)
Mutual labels:  hacktoberfest, laravel
Vulny Code Static Analysis
Python script to detect vulnerabilities inside PHP source code using static analysis, based on regex
Stars: ✭ 207 (-94.18%)
Mutual labels:  static-analysis, hacktoberfest
Laravelpackage.com
Documentation for LaravelPackage.com: Learn to create Laravel specific PHP packages from scratch, following this open documentation.
Stars: ✭ 214 (-93.98%)
Mutual labels:  hacktoberfest, laravel

Larastan Logo

Larastan Example

Build Status Total Downloads Latest Version License


⚗️ About Larastan

Larastan was created by Can Vural and Nuno Maduro, got artwork designed by @Caneco, is maintained by Can Vural, Nuno Maduro, and Viktor Szépe, and is a PHPStan wrapper for Laravel. Larastan focuses on finding errors in your code. It catches whole classes of bugs even before you write tests for the code.

  • Adds static typing to Laravel to improve developer productivity and code quality
  • Supports most of Laravel's beautiful magic
  • Discovers bugs in your code

While by definition, "static analysis" doesn't load any of your application's code. Larastan boots your application's container, so it can resolve types that are only possible to compute at runtime. That's why we use the term "code analysis" instead of "static analysis".

Getting Started In 3 Steps

Requires:

1: First, you may use Composer to install Larastan as a development dependency into your Laravel project:

composer require nunomaduro/larastan --dev

Using Larastan for analysing Laravel packages? You may need to install orchestra/testbench.

2: Then, create a phpstan.neon or phpstan.neon.dist file in the root of your application. It might look like this:

includes:
    - ./vendor/nunomaduro/larastan/extension.neon

parameters:

    paths:
        - app

    # The level 9 is the highest level
    level: 5

    ignoreErrors:
        - '#Unsafe usage of new static#'

    excludePaths:
        - ./*/*/FileToBeExcluded.php

    checkMissingIterableValueType: false

For all available options, please take a look at the PHPStan documentation: https://phpstan.org/config-reference

3: Finally, you may start analyzing your code using the phpstan console command:

./vendor/bin/phpstan analyse

If you are getting the error Allowed memory size exhausted, then you can use the --memory-limit option fix the problem:

./vendor/bin/phpstan analyse --memory-limit=2G

Ignoring errors

Ignoring a specific error can be done either with a php comment or in the configuration file:

// @phpstan-ignore-next-line
$test->badMethod();

$test->badMethod(); // @phpstan-ignore-line

When ignoring errors in PHPStan's configuration file, they are ignored by writing a regex based on error messages:

parameters:
    ignoreErrors:
        - '#Call to an undefined method .*badMethod\(\)#'

Baseline file

In older codebases it might be hard to spend the time fixing all the code to pass a high PHPStan Level.

To get around this a baseline file can be generated. The baseline file will create a configuration file with all of the current errors, so new code can be written following a higher standard than the old code. (PHPStan Docs)

./vendor/bin/phpstan analyse --generate-baseline

Rules

A list of configurable rules specific to Laravel can be found here.

Custom PHPDoc types

A list of PHPDoc types specific to Larastan can be found here.

Custom PHPStan config parameters

A list of custom config parameters that you can use in your PHPStan config file can be found here.

Errors To Ignore

Some parts of Laravel are currently too magical for Larastan/PHPStan to understand. We listed common errors to ignore, add them as needed

👊🏻 Contributing

Thank you for considering contributing to Larastan. All the contribution guidelines are mentioned here.

You can have a look at the CHANGELOG for constant updates & detailed information about the changes. You can also follow the Twitter account for the latest announcements or just come say hi!: @enunomaduro, @can__vural.

❤️ Support The Development

Do you like this project? Support it by donating

📖 License

Larastan is an open-sourced software licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].