{"id":13828626,"url":"https://github.com/appstract/laravel-blade-directives","last_synced_at":"2025-05-14T22:08:44.603Z","repository":{"id":47078807,"uuid":"93194639","full_name":"appstract/laravel-blade-directives","owner":"appstract","description":"A collection of nice Laravel Blade directives","archived":false,"fork":false,"pushed_at":"2023-06-14T09:09:09.000Z","size":117,"stargazers_count":857,"open_issues_count":6,"forks_count":73,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-04-13T18:44:39.371Z","etag":null,"topics":["blade","directives","laravel","laravel-package","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/appstract.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-06-02T18:45:43.000Z","updated_at":"2025-04-11T02:30:25.000Z","dependencies_parsed_at":"2024-01-28T01:16:00.931Z","dependency_job_id":null,"html_url":"https://github.com/appstract/laravel-blade-directives","commit_stats":{"total_commits":141,"total_committers":26,"mean_commits":5.423076923076923,"dds":0.7730496453900709,"last_synced_commit":"19129ea358a00ea0ef2781b4d41ef577c8008f2c"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appstract%2Flaravel-blade-directives","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appstract%2Flaravel-blade-directives/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appstract%2Flaravel-blade-directives/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appstract%2Flaravel-blade-directives/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appstract","download_url":"https://codeload.github.com/appstract/laravel-blade-directives/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254235700,"owners_count":22036964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blade","directives","laravel","laravel-package","php"],"created_at":"2024-08-04T09:02:55.961Z","updated_at":"2025-05-14T22:08:39.592Z","avatar_url":"https://github.com/appstract.png","language":"PHP","funding_links":["https://www.paypal.me/appstract/10","https://www.patreon.com/appstract"],"categories":["PHP"],"sub_categories":[],"readme":"# Laravel Blade Directives\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/appstract/laravel-blade-directives.svg?style=flat-square)](https://packagist.org/packages/appstract/laravel-blade-directives)\n[![Total Downloads](https://img.shields.io/packagist/dt/appstract/laravel-blade-directives.svg?style=flat-square)](https://packagist.org/packages/appstract/laravel-blade-directives)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://img.shields.io/travis/appstract/laravel-blade-directives/master.svg?style=flat-square)](https://travis-ci.org/appstract/laravel-blade-directives)\n\nA collection of nice Laravel Blade directives.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require appstract/laravel-blade-directives\n```\n\n## Usage\n\n### @istrue\n\nOnly show when `$variable` isset and true.\n\n```blade\n@istrue($variable)\n   This will be echoed\n@endistrue\n```\n\nOr when you would like to quickly echo\n\n```blade\n@istrue($variable, 'This will be echoed')\n```\n\n### @isfalse\n\nSame as `@istrue` but checks for isset and false.\n\n```blade\n@isfalse($variable)\n   This will be echoed\n@endisfalse\n```\n\n### @isnull\n\nOnly show when `$variable` is null.\n\n```blade\n@isnull($variable)\n   This will be echoed\n@endisnull\n```\n\n### @isnotnull\n\nSame as `@isnull` but one shows when `$variable` is not null.\n\n```blade\n@isnotnull($variable)\n   This will be echoed\n@endisnotnull\n```\n\n### @dump and @dd\n\n```blade\n@dump($var)\n\n@dd($var)\n```\n\n### @mix\n\nCreate a HTML element to your Laravel-Mix css or js.\n\n```blade\n@mix('/css/app.css')\n@mix('/js/app.js')\n```\n\nOutput:\n\n```blade\n\u003clink rel=\"stylesheet\" href=\"{{ mix('/css/app.css') }}\"\u003e\n\u003cscript src=\"{{ mix('/js/app.js') }}\"\u003e\u003c/script\u003e\n```\n\n### @style\n\nCreate a `\u003cstyle\u003e` element or `\u003clink\u003e` element with a css path.\n\n```blade\n@style\n    body { background: black }\n@endstyle\n\n\n@style('/css/app.css')\n```\n\n### @script\n\nCreate a `\u003cscript\u003e` element with or without a js path.\n\n```blade\n@script\n    alert('hello world')\n@endscript\n\n\n@script('/js/app.js')\n```\n\n### @inline\n\nLoad the contents of a css or js file inline in your view.\n\n```blade\n@inline('/js/manifest.js')\n```\n\n### @pushonce\n\nSame as `@push` but will include content one time only. Useful for repeatable blocks.\n\nFirst parameter must follow the syntax `stack-name:group-name`.\n\n```blade\n@pushonce('js:foobar')\n    \u003cscript src=\"{{ asset('/js/foobar.js') }}\"\u003e\u003c/script\u003e\n@endpushonce\n```\n\nInclude pushes with standard `@stack` directive:\n\n```blade\n@stack('js')\n```\n\n### @routeis\n\nChecks if the current route name is equal to the given parameter. You can use a wildcard like `blog.post.*`.\n\n```blade\n@routeis('webshop.checkout')\n    Do something only on the checkout\n@endrouteis\n```\n\n### @routeisnot\n\nChecks if the current route name is not equal to the given parameter. You can use a wildcard like `blog.post.*`\n\n```blade\n@routeisnot('webshop.checkout')\n    Do something only if this is not the checkout\n@endrouteisnot\n```\n\n### @instanceof\n\nChecks if the first parameter is an instance of the second parameter.\n\n```blade\n@instanceof($user, 'App\\User')\n    User is an instance of App\\User\n@endinstanceof\n```\n\n### @typeof\n\nChecks if the parameter is of a certain type.\n\n```blade\n@typeof($text, 'string')\n    Text is a string\n@endtypeof\n```\n\n### @repeat\n\nRepeat something a specified amount of times.\n\n```blade\n@repeat(3)\n    Iteration #{{ $iteration }}\n@endrepeat\n```\n\n### @fa, @fas, @far, @fal, @fab, @fad, @mdi, @glyph\n\nQuickly output an icon with Font Awesome, Material Design Icons or Glyphicon.\n\n```blade\n@fa('address-book', 'optional-extra-class')\n\n// for Font Awesome 5 (solid, regular, light, brand, duotone):\n@fas('address-book', 'optional-extra-class')\n@far('address-book', 'optional-extra-class')\n@fal('address-book', 'optional-extra-class')\n@fab('address-book', 'optional-extra-class')\n@fad('address-book', 'optional-extra-class')\n\n// for Material Design Icons\n@mdi('account', 'optional-extra-class')\n\n// for Glyphicons\n@glyph('glass', 'optional-extra-class')\n```\n\n### @data\n\nOutput data-attributes from an array.\n\n```blade\n@data(['testing' =\u003e 123])\n```\n\n### @haserror\n\nQuickly output for classical `$errors-\u003ehas('input_name')` to determine if any error messages exist for a given field.\n\n```blade\n@haserror('input_name')\n    This input has an error\n@endhaserror\n```\n\n### @count\n\nOutput number of entries.\n\n```blade\n@count([1,2,3])\n```\n\n### @nl2br\n\nReplaces `\\n` into `\u003cbr\u003e`.\n\n```blade\n@nl2br('foo\\n bar\\n baz\\n')\n```\n\n### @snake, @kebab, @camel\n\nOutput formatted string (uses Laravel Helpers).\n\n```blade\n@snake('fooBar')\n// output: 'foo_bar'\n\n@kebab('fooBar')\n// output: 'foo-bar'\n\n@camel('foo bar')\n// output: 'fooBar'\n```\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Contributing\n\nContributions are welcome, [thanks to y'all](https://github.com/appstract/laravel-blade-directives/graphs/contributors) :)\n\n## About Appstract\n\nAppstract is a small team from The Netherlands. We create (open source) tools for Web Developers and write about related subjects on [Medium](https://medium.com/appstract). You can [follow us on Twitter](https://twitter.com/appstractnl), [buy us a beer](https://www.paypal.me/appstract/10) or [support us on Patreon](https://www.patreon.com/appstract).\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappstract%2Flaravel-blade-directives","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappstract%2Flaravel-blade-directives","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappstract%2Flaravel-blade-directives/lists"}