PHPackages                             mfn/laravel-view-docblock - 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. mfn/laravel-view-docblock

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

mfn/laravel-view-docblock
=========================

Laravel View docblock argument validation

0.2(10y ago)013MITPHPPHP &gt;=5.6

Since Nov 21Pushed 10y ago1 watchersCompare

[ Source](https://github.com/mfn/laravel-view-docblock)[ Packagist](https://packagist.org/packages/mfn/laravel-view-docblock)[ Docs](http://github.com/mfn/php-laravel-view-docblock)[ RSS](/packages/mfn-laravel-view-docblock/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

Laravel View Docblock [ ![Travis Build Status](https://camo.githubusercontent.com/ff4e2d3082132c35a93fdc5c9a6d5bc17e250a89b04a8e5d632b134b595758e8/68747470733a2f2f7472617669732d63692e6f72672f6d666e2f7068702d6c61726176656c2d766965772d646f63626c6f636b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mfn/php-laravel-view-docblock)
====================================================================================================================================================================================================================================================================================================================================================

[](#laravel-view-docblock--)

Homepage:

Blurb
=====

[](#blurb)

Add a docblock to your view, describing what parameters and types the template accepts and let the library automatically handle the argument type validation.

Never fear of a) now knowing *what* arguments a template accepts and b) what *types* they should be.

Requirements
============

[](#requirements)

PHP 5.6 / Laravel 5.0/5.1

Install / Setup
===============

[](#install--setup)

Using composer: `composer.phar require mfn/laravel-view-docblock 0.1`

Register the service provider in your `config/app.php` by add this line to your `providers` entry: `Mfn\Laravel\ViewDocblock\Provider::class`

Note: it is advisable to register the provider *after* the laravel framework providers and *before* your custom ones.

Publish the configuration:

`php artisan vendor:publish --provider="Mfn\Laravel\ViewDocblock\Provider"`

Example
=======

[](#example)

Instead of:

```

            {!! Form::label("{$lang}[title]", trans('page::pages.form.title')) !!}
```

you add a docblock, specifying what parameters and types are accepted:

```

            {!! Form::label("{$lang}[title]", trans('page::pages.form.title')) !!}
```

For a list of supported defaul types, please see

Configuration
=============

[](#configuration)

- `enable_production`: Set to true to enable validation in production too. Defaults to `false`.
- `require_docblock_on_data`: Set to true to *require* a docblock on every template file. Defaults to `false`.
- `report_missing_arguments`: Set to true to report missing parameter types as errors. Defaults to `false`.
- `argument_blacklist`: A list of variables which should automatically be **excluded** from the validation. Useful for global or internal variables which are available in all templates.
- `additional_types`: register additional validation types, specific for Laravel:

    - `CollectionType`: supports `Collection`. Note: if an inner object type is provided (`SomeObject` in this example), the collection is iterated to ensure the types match!
    - `TraversableType`: transparently supports any class implementing the `Traversable` interface like an array. Note: inner types are ignored when encountering such a type.

The default settings are for easy getting started/integrating into existing projects. To take full effect of the library, the recommended settings are:

- `require_docblock_on_data` =&gt; `true`
- `report_missing_arguments` =&gt; `true`

However, undertand that Laravel is notorious in passing "global" variables to all templates, e.g. `$errors` is supposedly always available, which may render the option `report_missing_arguments` being set to `true` quite annoying.

Contribute
==========

[](#contribute)

Fork it, hack on a feature branch, create a pull request, be awesome!

No developer is an island so adhere to these standards:

- [PSR 4 Autoloader](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md)
- [PSR 2 Coding Style Guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
- [PSR 1 Coding Standards](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md)

© Markus Fischer

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Total

2

Last Release

3817d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4f0d4e7638e419a48dde77f4c481fb1eb2dbe8f5fe913e68e26269ee7e051ade?d=identicon)[mfn](/maintainers/mfn)

---

Top Contributors

[![mfn](https://avatars.githubusercontent.com/u/87493?v=4)](https://github.com/mfn "mfn (6 commits)")

---

Tags

laravelvalidationviewparameterargument

### Embed Badge

![Health badge](/badges/mfn-laravel-view-docblock/health.svg)

```
[![Health](https://phpackages.com/badges/mfn-laravel-view-docblock/health.svg)](https://phpackages.com/packages/mfn-laravel-view-docblock)
```

###  Alternatives

[rcrowe/twigbridge

Adds the power of Twig to Laravel

9105.9M50](/packages/rcrowe-twigbridge)[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)[moonshine/moonshine

Laravel administration panel

1.3k217.1k59](/packages/moonshine-moonshine)[spatie/laravel-blade-comments

Add debug comments to your rendered output

177325.5k](/packages/spatie-laravel-blade-comments)[ytake/laravel-smarty

Smarty template engine for Laravel and Lumen

87401.6k](/packages/ytake-laravel-smarty)

PHPackages © 2026

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