laravel-crop-str-blade-directive maintained by i3bepb
laravel-crop-str-blade-directive
Crop str blade directive
This project is no longer maintained. No further updates, bug fixes, or support for newer PHP or Laravel versions are planned.
Install
composer require i3bepb/laravel-crop-str-blade-directive
Final compatibility
| Package Version | Laravel Version | PHP Versions |
|---|---|---|
| 1 | 8 | 7.4, 8.0, 8.1 |
| 1 | 9 | 8.0, 8.1 |
PHP 8.2+, Laravel 7 and earlier, and Laravel 10+ are outside this compatibility range.
How use
With variable
For example, there is a $formatted variable with a text of more than 100 bytes, you can crop it using the directive
<div>As you can see @crop($formatted, 90)</div>
With string
Or an example with string
<div>@crop('Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu', 90)</div>
Result
<div>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor...</div>