PHPackages                             czim/with-blade-directive - 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. czim/with-blade-directive

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

czim/with-blade-directive
=========================

@with blade directive

1.1.0(9y ago)12.8k1MITPHPPHP &gt;=5.4.0

Since Aug 27Pushed 9y ago1 watchersCompare

[ Source](https://github.com/czim/with-blade-directive)[ Packagist](https://packagist.org/packages/czim/with-blade-directive)[ Docs](https://github.com/czim/with-blade-directive)[ RSS](/packages/czim-with-blade-directive/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (3)Versions (4)Used By (0)

Blade Directive: @with
======================

[](#blade-directive-with)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

A simple blade directive to help clean up your views.

Instead of doing this elaborate jig:

```

        {{ $model->relation->method()->object->first_name }}
        {{ $model->relation->method()->object->first_name }}
        {{ $model->relation->method()->object->email }}

```

You can clean it up like this:

```
    @with($model->relation->method()->object as $object)

        {{ $object->first_name }}
        {{ $object->first_name }}
        {{ $object->email }}

```

All this does is assign an expression to a variable.

Install
-------

[](#install)

Via Composer

```
$ composer require czim/with-blade-directive
```

Then add the service provider in `config/app.php`:

```
Czim\WithBladeDirective\WithBladeDirectiveServiceProvider::class,

```

Usage
-----

[](#usage)

The `@with` directive supports two formats:

```
    @with(any_expression($you * $want) as $variableName)

    @with('variableName', any_expression($you * $want))
```

These have exactly the same result.

Credits
-------

[](#credits)

- [Coen Zimmerman](https://github.com/czim)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity60

Established project with proven stability

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 ~16 days

Total

3

Last Release

3563d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1657b09521b6030fe32d864a493ded8b1dbbdf737ef3772135dfc123cea34767?d=identicon)[czim](/maintainers/czim)

---

Tags

blade-directiveslaravelsingularizepluralizeDutch

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/czim-with-blade-directive/health.svg)

```
[![Health](https://phpackages.com/badges/czim-with-blade-directive/health.svg)](https://phpackages.com/packages/czim-with-blade-directive)
```

###  Alternatives

[icanboogie/inflector

Multilingual inflector that transforms words from singular to plural, underscore to camel case, and more.

2122.5M71](/packages/icanboogie-inflector)[mmucklo/inflect

inflect - a memoizing inflector for php

4024.1M14](/packages/mmucklo-inflect)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3861.2M](/packages/limenius-react-bundle)[area17/laravel-auto-head-tags

Laravel Auto Head Tags helps you build the list of head elements for your app

4616.0k](/packages/area17-laravel-auto-head-tags)[jelix/wikirenderer

WikiRenderer is a library to generate HTML or anything else from wiki content.

1712.2k1](/packages/jelix-wikirenderer)[webkinder/sproutset

A Composer package for handling responsive images in Roots Bedrock + Sage + Blade projects.

281.8k](/packages/webkinder-sproutset)

PHPackages © 2026

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