Download the PHP package vaites/laravel-blade-expects without Composer

On this page you can find all versions of the php package vaites/laravel-blade-expects. 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 laravel-blade-expects

Current release Package at Packagist License

Laravel Blade @expects

This package is now abandoned and will no longer be maintained.

The @expects directive was created to document and validate variables passed to Blade templates. However, Laravel's built-in @props directive (introduced in Laravel 7) covers this use case natively and in a more integrated way — it declares expected variables, sets default values, and automatically excludes them from the $attributes bag.

If you need to declare expected variables in a Blade view, use @props instead:

Motivation

Blade templates are great, but lacks a good way to define the variables it requires to work. In a normal template you must check if variables are set and/or set a default value for it.

Take this example:

You must check if some variables are defined and set default values for some others. A colleague who has not worked with this template might ask:

In big templates with lots of complex HTML code mixed with CSS framework classes and JS framework attributes, guessing this information can be quite difficult. To solve these problems, this package adds a simple @expects directive to define the variables expected by the view.

Usage

Using it as a wrapper for a phpDoc block does the same and allows IDEs like phpStorm to type-hint the variables:

Both ways force $object to be defined as a \App\Object instance, $type as a string and $size will take the medium value if not set.

The directive can be called using multiline syntax to improve legibility:

The goal is that any programmer who works with the template knows immediately which variables are necessary for its operation, its types and default values.

PHP tags

You may also need to disable PHP tags in templates. This will prevent control structures from being used or variables from being declared, forcing the use of Blade directives for everything the template should do.

To do this just set the BLADE_EXPECTS_PHP_TAGS environment variable to true and and exception will be thrown if `


All versions of laravel-blade-expects with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
laravel/framework Version >=5.5
nikic/php-parser Version ~4.2
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 vaites/laravel-blade-expects contains the following files

Loading the files please wait ...