Download the PHP package glhd/laralint without Composer

On this page you can find all versions of the php package glhd/laralint. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laralint

LaraLint

GitHub Workflow Status Test Coverage

This is a very early work-in-progress linter for Laravel projects. It’s different from other PHP linters in that it focuses on building custom rules for your specific needs.

The goal is to make writing custom linters easy and fluent, just like writing Laravel-backed code. While the project uses an AST/tokenizers/etc under-the-hood, most common use-cases shouldn’t need a deep understanding of how that works.

Getting Started

Install this into your project with:

Once installed, you can lint your project using LaraLint’s default rules by running:

If you only want to lint uncommitted Git changes, you can pass the --diff flat to the command

Or, ff you only want to lint specific files, pass their filenames as the first argument:

Configuration and Presets

LaraLint comes with a very opinionated preset installed. If this works for you, great, but you’ll probably want to customize things to match your team’s code standards.

To start, publish the LaraLint config file:

This will install a laralint.php file into your project’s config/ directory with the default LaraLint config.

In some cases, you may be able to simply tweak the config to meet your needs. But it’s more likely that you’ll want to create your own preset.

Take a look at the Preset contract, or the default LaraLint Preset to get started. From there you can create a custom preset for your project that uses linters that make sense for your team. Mix and match the pre-built linters with your own custom linters to your heart’s content!

Custom Linters

If you’re interested in LaraLint, you’re probably interested in custom linters. Each team’s needs are different, and LaraLint tries to make it as easy as possible to quickly add logic that enforces your agreed upon conventions.

That said, LaraLint does rely on concepts like Abstract Syntax Trees, which can be intimidating at first. But with a few key concepts under your belt, you should be traversing that tree like a champ in no time!

Real Quick: How LaraLint Works

In as few words as possible:

LaraLint uses Microsoft’s Tolerant PHP Parser to parse your PHP code into an Abstract Syntax Tree, or AST. We use Microsoft’s parser because it’s fast and works well with partially-written code (like code you’re typing in your IDE). It’s also the basis for VS Code’s IntelliSense, so it’s got a good track record.

Think of this tree as a structured view of your code. Given the following PHP code:

The AST will look something like this (simplified for clarity’s sake):

LaraLint walks that tree from top to bottom, and passes each node to each applicable Linter for inspection. Linters are simply objects that receive AST nodes and optionally return linting results once the tree is fully walked.

This means you can write incredibly complex and custom linters, but hopefully you won't have to.

How to Write a LaraLint Linter

The core of most LaraLint Linters is a Matcher object. These objects are designed to easily match a general AST “shape” and flag part of the code if the entire “shape” is found. for example, if you wanted to flag any method named bar that returns the string 'baz', you could use the following matcher:

As soon as LaraLint finds a node that matches the first rule, it will begin looking for a child that matches the second rule. If it finds a child that matches the second rule, it will move on to the third rule. When it's matched all the rules, the matcher will trigger the onMatch callback, where you can perform any additional logic you choose.

LaraLint comes with several “strategies” that apply to common use-cases. These strategies abstract away even more of the logic, and are the best place to start. Look at some of the existing linters to understand how best to use each strategy.

But Wait… How Do I Write a LaraLint Linter?

OK, you’re probably looking at ReturnStatement and StringLiteral and thinking, “I don’t speak Abstract Syntax Tree.”

Neither does anyone else.

That's where the laralint:dump command comes into play. Say you’re trying to write the silly bar/baz linter from the example above. Simply create a PHP file that should fail, and dump its tree:

Which will output something like:

Between the output of the dump command, and the example of existing Linters, you’d be surprised how easy it is to start writing your own rules.

IDE Integration

The best place for linting results is right in your IDE. Rather than publishing our own IDE plugins, LaraLint can simply pretend to be PHP_CodeSniffer:

This will give you XML output that is compatible with any plugin that can parse PHP_CodeSniffer’s XML output (such as PhpStorm).

Running php artisan laralint:install will install a nice helper file that makes this a little easier. Just configure your IDE to point to that file, and your LaraLint lints should get flagged in your IDE.


All versions of laralint with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3.0
microsoft/tolerant-php-parser Version dev-main
illuminate/support Version ^6.0|^7.0|^8.0|^9.0|10.*|^11.0
illuminate/console Version ^6.0|^7.0|^8.0|^9.0|10.*|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package glhd/laralint contains the following files

Loading the files please wait ....