PHPackages                             sineld/bladeset - 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. sineld/bladeset

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

sineld/bladeset
===============

A very simple blade extension which allows variables to be set within blade templates.

v5.6.0(8y ago)4423.4k4MITPHPPHP &gt;=5.5.9

Since Sep 8Pushed 3y ago2 watchersCompare

[ Source](https://github.com/sineld/bladeset)[ Packagist](https://packagist.org/packages/sineld/bladeset)[ Docs](https://github.com/sineld/bladeset)[ RSS](/packages/sineld-bladeset/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)Dependencies (1)Versions (12)Used By (0)

Laravel Blade Variable Assign In Template
-----------------------------------------

[](#laravel-blade-variable-assign-in-template)

This package is heavily inspirated from [alexdover/blade-set](https://github.com/alexdover/blade-set) after [this discussion](https://github.com/laravel/framework/issues/4778).

A very simple blade extension which allows variables to be set within blade templates.

This versions is for Laravel v. 5-6-7-8-9 and should work with future versions of Laravel, if don't, please mail me.

### Usage Examples

[](#usage-examples)

```
@set('myVariable', $existing_variable)

// or

@set("myVariable", "Hello, World!")
```

Then you can use the variable `$myVariable` in the blade template.

```
{{ $myVariable }}
```

You might choose to fetch a bunch of models from your template, for example

```
@set('myModelList', MyModel::where('something', '=', 1)->paginate(10))
```

### Available Operators \[set, var, assign\]

[](#available-operators-set-var-assign)

```
@set('username', 'sineld')

@var("username", "sineld")

@assign('username', 'sineld')
```

Tip: You can assign your own operator in config file!

### Why?

[](#why)

Compare

```

```

to

```
@set('myModelList', MyModel::where('something', '=', 1)->paginate(10))
```

I felt that the use of the `@set` was a more elegant solution in the context of blade templates.

**Another reason (from [github issue page](https://github.com/laravel/framework/issues/4778#issuecomment-126774099)):**

An example where setting and keeping track of a variable inside a template using this sytax would be processing a list of things where each thing has a week and you want to set a week header for each group of weeks:

```
@set('week', 0);

@foreach ($things as $thing)
  @if ($week != $thing->week)
    WEEK {{ $thing->week }}
    @set('week', $thing->week)
  @endif

  Title: {{ $thing->title }}
@endforeach
```

### Installation

[](#installation)

Run this command on terminal in your packages root:

```
composer require sineld/bladeset
```

or

Require this package in your `composer.json`:

```
"sineld/bladeset": "8.0"
```

Update composer. This will download the package.

```
composer update
```

Add the BladeSetServiceProvider to the providers array in `config/app.php` if your projects Laravel version is below 5.5. If you Laravel version is higher or equal to 5.5 you do not need to add the line below to `config/app.php` file because package auto discovery is available.

```
Sineld\BladeSet\BladeSetServiceProvider::class,
```

(Optional) Publish package config.

```
php artisan vendor:publish
```

Then edit `app/config/bladeset.php` accoring to your needs.

All done!

### Licence

[](#licence)

You can use this package under the [MIT license](http://opensource.org/licenses/MIT)

### Feedback

[](#feedback)

If you have any questions, feature requests or constructive criticism then please get in touch.

Twitter - [@sineld](http://twitter.com/sineld)

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 97.6% 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 ~185 days

Recently: every ~0 days

Total

11

Last Release

1708d ago

Major Versions

v5.6.0 → 7.0.x-dev2021-10-05

5.3.x-dev → 8.0.x-dev2021-10-05

PHP version history (2 changes)v5.3.0PHP &gt;=5.5.9

5.0.x-devPHP &gt;=5.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/445349?v=4)[Sinan Eldem](/maintainers/sineld)[@sineld](https://github.com/sineld)

---

Top Contributors

[![sineld](https://avatars.githubusercontent.com/u/445349?v=4)](https://github.com/sineld "sineld (40 commits)")[![filippotoso](https://avatars.githubusercontent.com/u/26958813?v=4)](https://github.com/filippotoso "filippotoso (1 commits)")

---

Tags

laravelbladetemplatebladeset

### Embed Badge

![Health badge](/badges/sineld-bladeset/health.svg)

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

###  Alternatives

[robsontenorio/mary

Gorgeous UI components for Livewire powered by daisyUI and Tailwind

1.5k531.0k21](/packages/robsontenorio-mary)[hasinhayder/tyro-dashboard

Tyro Dashboard - Beautiful admin dashboard for managing Tyro roles, privileges, users, and settings

5222.7k](/packages/hasinhayder-tyro-dashboard)[technikermathe/blade-lucide-icons

A package to easily make use of Lucide icons in your Laravel Blade views.

18379.7k9](/packages/technikermathe-blade-lucide-icons)[hasinhayder/tyro-login

Tyro Login - Beautiful, customizable authentication views for Laravel 12 &amp; 13

2443.7k5](/packages/hasinhayder-tyro-login)[ublabs/blade-simple-icons

A package to easily make use of Simple Icons in your Laravel Blade views.

1958.8k](/packages/ublabs-blade-simple-icons)

PHPackages © 2026

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