Download the PHP package kanuni/laravel-blade-anchor without Composer

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

Laravel Blade Anchor ⚓

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Easily enable extending your application's user interface by third-party packages with anchors.

Installation

You can install the package via composer:

Usage

To allow third-party packages to extend your application's UI, you need to insert anchors into your Blade template files at the points where you want to permit these extensions.

Placing anchors to enable UI extensions

In your Blade file (e.g., resources/views/welcome.blade.php), you can add an anchor directive. For this example, let's create an anchor immediately after the opening <body> tag:

You can name the anchor anything you like. In this example, we've named it begin.body.

Creating an extender class

Once you've positioned your anchor, you can now register an extender class that will render a string or a Laravel View at that anchor point. Ideally, you should register your anchor extenders in the boot() method of your AppServiceProvider class.

But first, let's create a new anchor extender class using the Artisan command:

This command generates a new extender class in app/BladeExtenders/WelcomePageExtender.php. This class should implement the __invoke() method, whose return value will be rendered at the specified anchor point.

Here's an example of our newly created class:

The __invoke() method can return a string or a View and accepts an optional array of variables available in your Blade template. If returning a Blade view, you can pass the variables to your view like this:

It's also possible to inject any dependency classes into your extender's __construct() method:

Attaching the Extender to the Anchor

Register your Blade extender in the boot() method of app/Providers/AppServiceProvider class using LaravelBladeAnchor facade. To do this, call the registerExtender method and provide the view name, anchor name, and extender class.

As demonstrated, anchor names are unique within each view. This means you can have anchors with the same name across two different views without any conflict.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

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


All versions of laravel-blade-anchor with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^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 kanuni/laravel-blade-anchor contains the following files

Loading the files please wait ....