Download the PHP package skybluesofa/laravel-wrapped-facade without Composer

On this page you can find all versions of the php package skybluesofa/laravel-wrapped-facade. 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-wrapped-facade

Laravel Wrapped-Facade

Add before- and after- method calls to Facades.

Purpose

This library creates the ability to add pre- and post- methods when calling Facade methods. You can find an example in the tests folder.

It is most useful purpose that I have found is to cache information instead of running a request.

Laravel Version Compatibility

This package supports Laravel v9 and v10

Installation

Setup

Install the Config File

Publish the Config File

Run the artisan command to publish the package's config file:

or

Copy the Config File

Copy the wrapped-facade.php file from the vendor/skybluesofa/laravel-wrapped-facade/config folder to your application's config folder.

Using Wrapped Facades

Wrapped Facades work, out-of-the-box, exactly the same as standard (Laravel Facades)[https://laravel.com/docs/10.x/facades].

Basic Facade Functionality

Lets start with the base Fruits class:

And now we'll create a SuperFruits facade, though it could be named Fruits, if you wanted:

When you run the facade code, you will get a returned array of fruits and vegetables.

Sideloading Functionality into the Facade

The difference is when you wish to add some new functionality to the method, before and/or after it gets run.

Example: Caching Results

We'll add a new attribute and a couple of methods:

Now when you run the facade code, you will still get a returned array of fruits and vegetables, but the next time it's accessed, it will be returned from the cache.

Example: Modifying Results

In this example, we're not going to cache the results. Instead we're going to filter the results based on the preferences of the logged in user.

We'll change the class to only have a 'postIndex' method:

Now when you run the facade code, you will still get a returned array of fruits and vegetables, but it 'Banana' has been removed from the array.

Example: Using Multiple Sideloaded Functionality

In this example, we're going to validate the results before we cache them.

We'll update the class to include a new 'postIndexValidate' method and a 'sideloadedMethodOrder' property:

We're going to assume that FruitValidator::validates() will return false. So now when you run the facade code, a \RuntimeException will be thrown.

Please note that the $sideloadedMethodOrder array can be formatted in multiple ways. All of these are equally valid:


All versions of laravel-wrapped-facade with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
laravel/framework Version ^10 || ^9.0
spatie/laravel-package-tools Version ^1.16
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 skybluesofa/laravel-wrapped-facade contains the following files

Loading the files please wait ....