Download the PHP package bitpress/blade-extensions without Composer

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

Laravel Blade Extension Classes

This Laravel >=5.5 package allows you to organize your Blade extensions into classes. It provides a simple container pass that registers all your extensions with the Blade compiler using a simple tag.

Organizing Blade extensions as classes in the service container allows you to group extension functionality within one object, allowing you to inject dependencies through the service container and provide shared protected/private methods.

Installation

You can install this package via Composer using the following command:

This package will automatically register the included service provider.

Usage

At a high level, the goal of this package is to make it easy and convenient to register blade extensions as classes from the service container automatically using service container tagging. Here's the gist of how it works:

  1. Create a new Extension class with php artisan make:blade Example
  2. Register the Extension in a service provider's register() method
  3. Tag the service with blade.extension
  4. The BladeExtensionServiceProvider automatically wires up the directives in the blade compiler during boot().

Creating a new Extension Class

It would be annoying to create a new extension class from scratch each time, so this package provides an artisan command to create your extensions under the App\Blade namespace:

Defining the Extension Directives and Conditionals

Once you create a blade extension class, you can define supported directives, conditionals, or both. Custom Blade directives and conditionals are simply PHP callables:

Note that Blade extension classes implement the BladeExtension contract, which includes getDirectives() and getConditionals(). Even if you don't plan on registering any conditionals, for example, you must implement the getConditionals() method and return an empty array.

Your custom blade extension will be registered in the service container, so you can define a __construct() method and inject services from the container. The fact that Blade extensions are services allows you to group common code around your blade extensions, including those directives that depend on outside services that are registered in the container.

Registering a New Blade Service

After you define a blade extension, you still need to register it in the service container and tag it properly so the BladeExtensionServiceProvier can define the PHP callables in the Blade compiler during boot().

This package provides a BladeRegistrar class to define the extension in the container and tagging it properly, for example, in App\Providers\AppServiceProvider:

If you need to, you can create the service in a Closure:

You can also use the blade_extension() helper function to register the service if you prefer:

Without the Blade extension registrar, this is how you'd define an extension manually:

The benefit of using the BladeRegistrar class is that it takes care of defining a consistent tag across any number of service providers and removes the boilerplate.

Registering Extensions with the Blade Compiler

The way this package works is quite simple, here's how the boot() method actually gets all registered extensions and defines them with the Blade compiler:

License

The MIT License (MIT). Please see License File for more information.


All versions of blade-extensions with dependencies

PHP Build Version
Package Version
No informations.
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 bitpress/blade-extensions contains the following files

Loading the files please wait ....