PHPackages                             mmo-and-friends/laravel-text-flags - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mmo-and-friends/laravel-text-flags

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mmo-and-friends/laravel-text-flags
==================================

A Laravel package to replace flags found in the text with array values ​​or objects

v2.0.0(4y ago)029MITPHPPHP ^7.4|^8.0

Since Feb 5Pushed 4y ago1 watchersCompare

[ Source](https://github.com/mmo-and-friends/laravel-text-flags)[ Packagist](https://packagist.org/packages/mmo-and-friends/laravel-text-flags)[ RSS](/packages/mmo-and-friends-laravel-text-flags/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

Laravel Text Flags
==================

[](#laravel-text-flags)

*A Laravel package to replace flags found in the text with array values ​​or objects*

### Install 🔧

[](#install-)

```
    composer require mmo-and-friends/laravel-text-flags
```

### Quick Sample Usage ⌨️

[](#quick-sample-usage-️)

```
use MmoAndFriends\LaravelTextFlags\TextFlags;

class HomeController extends Controller
{

    //
    // For capture the flags you need use the syntax: "{model:attribute}" or "{model:attribute.relation.attribute}"
    //

    /**
     * Maybe you need returns a partial html
     *
     * @return \Illuminate\Response
     */
    public function contactInfo(){

        // Filling the text flags with the values

        $textFlags = TextFlags::fill([
            'contact_info' => [
                'organization'  => 'Mmo&Friends',
                'manager_name'  => 'Guillermo Rodriguez'
                'manager_email' => 'guillermo.rod.dev@gmail.com',
            ],
            'items' => [
                [
                    'name' => 'Some book',
                    'price' => 450,
                    'category' => [
                        'name' => 'Books'
                    ]
                ],
                [
                    'name' => 'Other book',
                    'price' => 340,
                    'category' => [
                        'name' => 'Books'
                    ]
                ]
            ]
        ]);

        // Reading the text

        $html = $textFlags->read('

                Organization: {contact_info:organization}
                Manager: {contact_info:manager_name}
                Manager Email: {contact_info:manager_email}

                {each:items}
                    {each_v:name} | ${each_v:price} | {each_v:category.name}
                {end_each:items}

        ')
        ->apply();

        return $html;
    }

    /**
     * In some cases you need that the users uploads an custom format for a ticket, pdf, etc,,,
     *
     * But use the blade engine can be dangerous for sql injections or query statements with the @php directive,
     * so that was the reason for i create this package
     *
     * In this way you can return the custom user format (html) with the real value to the pdf api or do what you need
     *
     * @return string
     */
    public function getSaleTicket($token)
    {
        $saleTicket = \App\Models\SaleTicket::select('id','note','format_id')
                        ->with('order.products')
                        ->with('contact')
                        ->where('token',$token)
                        ->first();

        $html = $saleTicket->getHtmlFormatView();

        // Hiding some data null|unset

        $saleTicket->important_attribute = null;
        unset($saleTicket->important_attribute);

        //Adding some default styles {ticket:styles.table} {ticket:styles.button}

        $saleTicket->styles = [
            'table'  => 'padding: 10px; border: 1px solid',
            'button' => 'rounded: 8px; border: 1px solid blue; background-color:blue; color: white',
        ];

        // Filling the text flags with the values

        $textFlags = TextFlags::fill([
            'ticket' => $saleTicket,
        ]);

        // Reading the full html and return after apply the values

        return $textFlags->read($html)->apply();
    }
}
```

Author ✒️
---------

[](#author-️)

*Guillermo Rodriguez / *

License 📄
---------

[](#license-)

This project is under the license (MIT) - Look the file [LICENSE.md](LICENSE.md).

###  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

Maturity56

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

Total

3

Last Release

1524d ago

Major Versions

v1.0.1 → v2.0.02022-03-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/d127ab3f8c3f8afcccbe71c1600ab8e54c3f303f6d9044d44010f50e48bdffd0?d=identicon)[MmoAndFriends](/maintainers/MmoAndFriends)

---

Top Contributors

[![mmo-and-friends](https://avatars.githubusercontent.com/u/99046764?v=4)](https://github.com/mmo-and-friends "mmo-and-friends (11 commits)")

### Embed Badge

![Health badge](/badges/mmo-and-friends-laravel-text-flags/health.svg)

```
[![Health](https://phpackages.com/badges/mmo-and-friends-laravel-text-flags/health.svg)](https://phpackages.com/packages/mmo-and-friends-laravel-text-flags)
```

PHPackages © 2026

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