PHPackages                             pragmarx/steroids - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. pragmarx/steroids

ActiveLibrary[Templating &amp; Views](/categories/templating)

pragmarx/steroids
=================

Laravel 4 Blade on Steroids

v0.8.3(8y ago)942056BSD-3-ClausePHPPHP &gt;=5.3.7

Since Feb 28Pushed 8y ago8 watchersCompare

[ Source](https://github.com/antonioribeiro/steroids)[ Packagist](https://packagist.org/packages/pragmarx/steroids)[ RSS](/packages/pragmarx-steroids/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (6)Versions (9)Used By (0)

Steroids v0.7
=============

[](#steroids-v07)

[![Latest Stable Version](https://camo.githubusercontent.com/dd492773a15d1d5cad50ffabbcf635de63f14f69293eed0d7c94a54f72b85965/68747470733a2f2f706f7365722e707567782e6f72672f707261676d6172782f737465726f6964732f762f737461626c652e706e67)](https://packagist.org/packages/pragmarx/steroids) [![License](https://camo.githubusercontent.com/07b27f85b47c2b935f81cead6837677a9c766974aa09e3ec941a154ae2eb9f1f/68747470733a2f2f706f7365722e707567782e6f72672f707261676d6172782f737465726f6964732f6c6963656e73652e706e67)](https://packagist.org/packages/pragmarx/steroids) [![Build Status](https://camo.githubusercontent.com/18994e3d0d2e55609040a2608b60359b95c30a0c29f6bc6bccbb5c925d0d68d0/68747470733a2f2f7472617669732d63692e6f72672f616e746f6e696f7269626569726f2f737465726f6964732e706e67)](https://travis-ci.org/antonioribeiro/steroids) [![Latest Stable Version](https://camo.githubusercontent.com/ba4a570854e9b4387ec7ca6a0a0b8a053e27a92714e443313cee67595978c3c8/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f616e746f6e696f7269626569726f2f737465726f6964732f62616467652e706e67)](https://coveralls.io/r/antonioribeiro/steroids)

Laravel 4 Blade on Steroids
---------------------------

[](#laravel-4-blade-on-steroids)

This package provides some aditional features to Laravel Blade:

### Automatic command generation

[](#automatic-command-generation)

Create a file named `.blade.php` in the templates directory and it automatically becomes a blade command.

Take the file

```
default\css.blade.php

```

Whaving the contents:

```

```

Hackers can now use the command

```
@css(/css/bootstrap.css)

```

In their blade templates to generate:

```

```

### Subtemplating

[](#subtemplating)

Every sublevel in your template directory creates a level in command name. This tree:

```
├── default
│   ├── input.blade.php
│   ├── js.blade.php
│   └── php.blade.php
│   └── text.blade.php
├── bs
│   └── v2
│   │   ├── input.blade.php
│   │   └── form.blade.php
│   │   └── model.blade.php
│   ├── input.blade.php
│   └── form.blade.php

```

Would give you the following commands:

```
@input()
@js()
@php()
@text()

@bs.input()
@bs.form()

@bs.v2.input()
@bs.v2.form()
@bs.v2.model()

```

### Block commands

[](#block-commands)

Let's take the (silly, I know! :) `@php` (file `php.blade.php`) command as an example of a block:

```
@php
    $title = 'subscribe';
@@

```

Note that a block ends with `@@` and you can have as many nested blocks as you want. This is the `@php` command's source code:

```

```

It's that simple, to create a block command you just have to add the `@_BODY` identifier in any part of your command.

### Extending commands

[](#extending-commands)

You can create an `@input` command:

```

```

And use it to create a

`@text`:

```
@input(text,@_PARAMETERS)

```

`@email`:

```
@input(email,@_PARAMETERS)

```

and `@password` commands:

```
@input(password,@_PARAMETERS)

```

### HTML Attributes, Local Variables and Positional Parameters

[](#html-attributes-local-variables-and-positional-parameters)

You can dynamically create and send any number of parameters to your commands:

#### HTML Attributes

[](#html-attributes)

Take @input as an example:

```
@input(type=email,class=form-control,id=example,placeholder=Enter email)

```

Having this template

```

```

It will generate this tag:

```

```

#### Local Variables

[](#local-variables)

Use a hash to define a local variable:

```
@input(#type=email,class=form-control,id=example,placeholder=Enter email)

```

And you access it by using the variable identifier `@_`:

```

```

#### Positional Parameters

[](#positional-parameters)

You also can access any of yours parameter by the number, let's set the type of input as the first one:

```
@input(email,class=form-control,id=example,placeholder=Enter email)

```

Then you just have to use the variable identifier followed by the parameter number:

```

```

Another example is the Form::model(), provided by `@model`, this is the template

```
{{ Form::model(@_1, $options) }}
    @_BODY
{{ Form::close() }}

```

And in your view you just have to:

```
@model($user,url=/profile)
    ... your controls ...
@@

```

#### Assignment and Multi Assignment

[](#assignment-and-multi-assignment)

You assign values to local (#) variables by using the equal sign:

```
@text(#label=form-control)

```

You assign values to html attributes by doing the same, just don't put the hash sign:

```
@text(class=form-control)

```

And you can also do multi assignments:

```
@text(#label=title=First Name,class=form-control)

```

### Superglobals (licentia poetica)

[](#superglobals-licentia-poetica)

`@_BODY`: will be replaced by your command body

`@_ATTRIBUTES`: all HTML attributes generated by your command

`@_PARAMETERS`: it's a raw list of parameters, you can use it to pass them forward to an extended command, this is the source of `@text`, which extends `@input`:

```
@if (@_name->has)
    @input(text,name=@_1,@_PARAMETERS)
@else
    @input(text,@_PARAMETERS)
@endif

```

`@_SINGLE`: if you have a command that accepts only one parameter

```
@h1(Hi There!)

```

You can use this superglobal:

```
@_SINGLE

```

But you can still use the positional variable:

```
@_1

```

### Special functions

[](#special-functions)

#### -&gt;has

[](#-has)

If you need to know if a variable was set you can use the `->has` function:

```
@if (@_label->has)
    @_label
@endif

```

The `->has` function will return `true` or `false`, and then your view (in PHP) would probably look like this:

```

```

Steroids comes with some examples:

#### -&gt;bare

[](#-bare)

If you need to access one of your HTML attributes you can use the `->bare` function:

```

```

### Delimiters and Quotation marks

[](#delimiters-and-quotation-marks)

As delimiters of your parameters you can use `,` or `;`:

```
@input(email,class=form-control,id=example,placeholder=Enter email)

@input(email;class=form-control;id=example;placeholder=Enter email)

```

You don't need to use quotation marks (single `'` or double `"`), unless you need to use any of those delimiters in your strings:

```
@input(email,placeholder="Hello, World!")

```

### Examples

[](#examples)

Steroids comes with some examples, but you can get crazy and create as many as you wish:

```
├── default
│   ├── css.blade.php
│   ├── form.blade.php
│   ├── h.blade.php
│   ├── input.blade.php
│   ├── js.blade.php
│   ├── model.blade.php
│   ├── p.blade.php
│   ├── php.blade.php
│   ├── row.blade.php
│   └── text.blade.php
├── bs
│   ├── md.blade.php
│   └── xs.blade.php

```

### Easy creation of partials

[](#easy-creation-of-partials)

Sometimes creating s simple box can be as complicated as:

```

                    @editbox('your name goes here')

                    @_BODY

```

But after Steroids, you just need to do this in your code:

```
@box
    And do whatever you need inside it!
@@

```

### Artisan Commands

[](#artisan-commands)

Steroids has two artisan commands:

`steroids:templates` - to copy the examples to your `app/config/package` folder

```
php artisan steroids:templates

```

`steroids:list` - list all of your Steroids commands

```
php artisan steroids:list

```

`view:clear` - to clear you views cache

```
php artisan view:clear

```

### Using the Facade directly

[](#using-the-facade-directly)

To compile a view using Steroids, you just have to:

```
 return Steroids::inject('@input(type=email,name=email,class=form-control)')

```

### Installation

[](#installation)

#### Requirements

[](#requirements)

- Laravel 4.1+
- Composer &gt;= 2014-01-07 - This is a PSR-4 package

#### Installing

[](#installing)

Require the Steroids package:

```
composer require pragmarx/steroids dev-master

```

Add the service provider to your app/config/app.php:

```
'PragmaRX\Steroids\Vendor\Laravel\ServiceProvider',

```

To publish the configuration file you'll have to:

```
php artisan config:publish pragmarx/steroids

```

Copy the templates examples to your app folder:

```
php artisan steroids:templates

```

### Tests

[](#tests)

- Steroids Tests Coverage is at 100%

### TODO

[](#todo)

- Invalidate main templates when a Steroids command changes

### Author

[](#author)

[Antonio Carlos Ribeiro](http://twitter.com/iantonioribeiro)

### License

[](#license)

Steroids is licensed under the BSD 3-Clause License - see the `LICENSE` file for details

### Contributing

[](#contributing)

Pull requests and issues are more than welcome.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~176 days

Recently: every ~308 days

Total

8

Last Release

3218d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d9421a69d192db597169ec3519ad3efc6a35a660e4525e2ed08f6c753b908e86?d=identicon)[AntonioCarlosRibeiro](/maintainers/AntonioCarlosRibeiro)

---

Top Contributors

[![antonioribeiro](https://avatars.githubusercontent.com/u/3182864?v=4)](https://github.com/antonioribeiro "antonioribeiro (84 commits)")[![nullcitizen](https://avatars.githubusercontent.com/u/773294?v=4)](https://github.com/nullcitizen "nullcitizen (2 commits)")

---

Tags

laravel-bladephplaravelbladetemplateview

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pragmarx-steroids/health.svg)

```
[![Health](https://phpackages.com/badges/pragmarx-steroids/health.svg)](https://phpackages.com/packages/pragmarx-steroids)
```

###  Alternatives

[tightenco/jigsaw

Simple static sites with Laravel's Blade.

2.2k438.5k29](/packages/tightenco-jigsaw)[jenssegers/blade

The standalone version of Laravel's Blade templating engine for use outside of Laravel.

8661.2M109](/packages/jenssegers-blade)[fiskhandlarn/blade

A library for using Laravel Blade templates in WordPress/WordPlate.

365.8k](/packages/fiskhandlarn-blade)[leitsch/kirby-blade

Enable Laravel Blade Template Engine for Kirby 4 and Kirby 5

219.2k](/packages/leitsch-kirby-blade)[johnturingan/laravel-fly-view

Render Blade templates from string mark-up.

163.9k](/packages/johnturingan-laravel-fly-view)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
