PHPackages                             chargefield/laravel-widget - 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. chargefield/laravel-widget

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

chargefield/laravel-widget
==========================

Widget based approach for structuring portions of your views.

1.0.5(6y ago)116MITPHPPHP &gt;=7.1.0

Since Oct 24Pushed 6y ago1 watchersCompare

[ Source](https://github.com/chargefield/laravel-widget)[ Packagist](https://packagist.org/packages/chargefield/laravel-widget)[ RSS](/packages/chargefield-laravel-widget/feed)WikiDiscussions master Synced today

READMEChangelog (6)Dependencies (5)Versions (7)Used By (0)

Laravel Widget
==============

[](#laravel-widget)

[![Latest Stable Version](https://camo.githubusercontent.com/ada654f299327008060088fe5ef0a18d2d82a66c4fea7e585b1f1df696d11d3b/68747470733a2f2f706f7365722e707567782e6f72672f6368617267656669656c642f6c61726176656c2d7769646765742f762f737461626c65)](https://packagist.org/packages/chargefield/laravel-widget)[![Total Downloads](https://camo.githubusercontent.com/56d5fdcf8d5d0d95e8f9518f989d4993364d550bb6f5876d7840f97a3733234d/68747470733a2f2f706f7365722e707567782e6f72672f6368617267656669656c642f6c61726176656c2d7769646765742f646f776e6c6f616473)](https://packagist.org/packages/chargefield/laravel-widget)[![License](https://camo.githubusercontent.com/23a19ca762b87a1063082268a9c40a824a7c61a95b35f69cc5ef06d430b95509/68747470733a2f2f706f7365722e707567782e6f72672f6368617267656669656c642f6c61726176656c2d7769646765742f6c6963656e7365)](https://packagist.org/packages/chargefield/laravel-widget)

Laravel Widget is a class based approach for structuring portions of your views.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require chargefield/laravel-widget
```

Usage
-----

[](#usage)

### Artisan Command

[](#artisan-command)

```
php artisan make:widget ExampleWidget
```

or

```
php artisan widget:make ExampleWidget
```

This will generate the following files:

*app/Http/Widgets/ExampleWidget.php*

*resources/views/widgets/example-widget.blade.php*

### Blade Directive

[](#blade-directive)

Including a widget is as easy as using the `@widget` blade directive:

```
@widget('ExampleWidget')
```

You can pass external data to the widget as an array to the second argument. It will be available in both the class and view:

```
@widget('ExampleWidget', ['four' => 'Four'])
```

### Widget Data

[](#widget-data)

All public properties and public methods are passed down to the view as their respected names.

**Example**

Widget Class:

```
namespace App\Http\Widgets;

use Chargefield\LaravelWidget\BaseWidget;

class ExampleWidget extends BaseWidget
{
    public $title = 'Hello World';

    public function numbers()
    {
        return [
            'One', 'Two', 'Three', $this->four,
        ];
    }
}
```

Widget Blade View:

```
{{ $title }}
@foreach($numbers as $number)
{{ $number }}
@endforeach
```

Output:

```
Hello World
One
Two
Three
Four
```

### Testing

[](#testing)

You can run the tests with:

```
vendor/bin/phpunit
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Clayton D'Mello](https://github.com/chargefield)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

6

Last Release

2392d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7b4308d6364461310c6b27d2c0e93835fc3e1237a918967350648aa80a0ab8b9?d=identicon)[chargefield](/maintainers/chargefield)

---

Top Contributors

[![chargefield](https://avatars.githubusercontent.com/u/13471440?v=4)](https://github.com/chargefield "chargefield (29 commits)")

### Embed Badge

![Health badge](/badges/chargefield-laravel-widget/health.svg)

```
[![Health](https://phpackages.com/badges/chargefield-laravel-widget/health.svg)](https://phpackages.com/packages/chargefield-laravel-widget)
```

###  Alternatives

[tightenco/jigsaw

Simple static sites with Laravel's Blade.

2.2k438.5k29](/packages/tightenco-jigsaw)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

703141.0k7](/packages/tallstackui-tallstackui)[livewire/blaze

A tool for optimizing Blade component performance by folding them into parent templates

688221.3k17](/packages/livewire-blaze)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

44643.1k1](/packages/pressbooks-pressbooks)

PHPackages © 2026

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