Download the PHP package rapidez/blade-directives without Composer

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

Rapidez Blade Directives

This package adds blade directives that we found we needed in Laravel during development of Rapidez. Like @slots, which lets you define optional slots so your attributes->merge() always works. Or @includeFirstSafe which works the same as @includeFirst but will not throw errors if no template was found. All directives included within this package:

Installation

Directives

@attributes

The @attributes blade directive allows you to pass the attributes for a html element using an array. It's functionally the same as the $attributes of a blade component but you can use it outside of blade components!

Usage

Example

which will result in

@includeFirstSafe

The @includeFirstSafe blade directive works the same way that @includeFirst does however it will not throw an error if all templates do not exsist. Outside of production mode it will alert about the missing templates however.

Usage

Example

@markdown

You can use the @markdown directive to transform markdown into html. Basically, {!! Str::markdown($text) !!} but in directive form.

Usage

@return

The @return blade directive simply stops any further processing of the current template

Usage

Example

Or only when a condition is true:

@slotdefault

When you've an optional slot this directive gives you a cleaner way of defining a fallback. Normally you do something like this:

Usage

@slots

The @slots blade directive is used within blade components. It is used to define optional named slots which will be created if they are not passed. Very useful if named slots might not always be passed but you want to use the attributes of this named slot

Usage

Within your blade component:

If you enter nothing and only load in the component without passing any named slots it will be

but if you were to pass the named slots it would look like this:

As you can see it has overwritten the class of the optional slot, but not the attributes->class()

If you only wish to change the text without changing attributes you can also pass them as attributes.

@includeCached

Just like @include but cached. Everything returned will be cached with Cache::flexible() for 5 minutes; and refreshed in the background until it expires after 24 hours. After that it will be refreshed as usual. The cache key is a combination of the view name and the current slugified url. That way this can be used with multisite setups:

Usage

Notes

Keep in mind that any dynamic things within the view will not be executed when cached. For example @push, see Blade Stacks. Also Blade Icons Deferring doesn't work, you have to use these things outside the cached include!

Helpers

optionalDeep

Have you heard of optional()? This is the supercharged version working at any depth! It makes sure that any missing key will not break your code, especially helpful when mixing Statamic with Blade

Usage

It will automatically return the value when casting to string so you can immediately echo out it's value, if you want to get the value use the get method. This will return null if anywhere along the chain the value or key does not exist.

[!TIP] the OptionalDeep class implements Macroable, allowing you to extend it with your own functions!

License

GNU General Public License v3. Please see License File for more information.


All versions of blade-directives with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0|^8.1|^8.2|^8.3|^8.4
illuminate/support Version ^9.0|^10.0|^11.0|^12.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 rapidez/blade-directives contains the following files

Loading the files please wait ....