Download the PHP package imliam/laravel-blade-helper without Composer

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

Laravel Blade Helper

Latest Version on Packagist Build Status CI Status Total Downloads

An easier way to define custom Blade directives.

When creating new custom Blade directives using the Blade::directive(…) method, the only parameter made available to manipulate is the expression passed through from the .blade.php file as a raw string. It seems to be rare that developers actually parse the contents of the expression itself within the directive, opting instead to pass the entire expression as arguments to a helper function or a method on another class. For example:

As this seems to be the most common use case, this package attempts to help make these helper functions that little bit easier to define without the boilerplate of returning the string or having to consider what an expression may be when creating a directive.

💾 Installation

You can install the package with Composer using the following command:

📝 Usage

The BladeHelper object is bound to Laravel's service container with the name blade.helper and can be used by resolving that. A Facade is also made available for convenience. To define a helper, the directive(…) method is used:

This method accepts two arguments; the first is the name of the directive, and the second is the function that the directive should call:

If no second argument is supplied, the directive will attempt to call a function of the same name:

The second argument can also take a callback. The advantage of a callback here over the typical Blade::directive(…) method Laravel offers is that the callback given can have specific parameters defined instead of just getting raw expression as a string. This brings several advantages to the process of creating a Blade helper directive:

By default, all of the helper directives will echo out their contents to the view when used. This can be disabled by passing false as the third argument:

Example Helper Directive

One example of a custom Blade helper is to wrap around FontAwesome 4 icons to make it more convenient to add alternate text for the sake of accessibility:

Custom "if" Directive

Laravel Blade offers a handy way to define custom "if" statement directives. The Blade Helper package offers an additional method to generate these directives, with if, elseif and endif variants all automatically generated.

An if statement can be defined in the same way as the directive method, but must be given a callable as its second argument:

Once defined, the helpers can be used directly in your Blade templates:

✅ Testing

🔖 Changelog

Please see the changelog file for more information on what has changed recently.

⬆️ Upgrading

Please see the upgrading file for details on upgrading from previous versions.

🎉 Contributing

Please see the code of conduct for details on contributing to the project.

🔒 Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

👷 Credits

♻️ License

The MIT License (MIT). Please see the license file for more information.


All versions of laravel-blade-helper with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
illuminate/support Version ^7.0|^8.0|^9.0|^10.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 imliam/laravel-blade-helper contains the following files

Loading the files please wait ....