PHPackages                             dnabeast/tusk - 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. dnabeast/tusk

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

dnabeast/tusk
=============

Creates a plugin file to replace text in a string with any php or html code

1.0.3(4y ago)053[1 PRs](https://github.com/dnabeast/tusk/pulls)MITPHP

Since Aug 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/dnabeast/tusk)[ Packagist](https://packagist.org/packages/dnabeast/tusk)[ RSS](/packages/dnabeast-tusk/feed)WikiDiscussions master Synced 5d ago

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

Plugin code replacement in a string for Laravel
===============================================

[](#plugin-code-replacement-in-a-string-for-laravel)

Problem
-------

[](#problem)

Your user needs to inject a chunk of code into a basic string using their CMS functionality. You want them to be able to set a Google map or text from a database but you don't want them to be able to run code.

Solution
--------

[](#solution)

Set up their code and allow them to reference it in their text string.

Installing
==========

[](#installing)

Add the dependency to your project:

```
composer require DNABeast/tusk

```

### Laravel 5.2:

[](#laravel-52)

After updating composer, add the ServiceProvider to the providers array in config/app.php

```
DNABeast\Tusk\TuskServiceProvider::class,

```

Add the directory Plugin/lib to your App directory to contain your plugin files.

You may need to clear the view cache

```
php artisan view:clear

```

Usage
=====

[](#usage)

In your blade file put your string inside the tusk directive.

```
@tusk('Your string [[- map -]]. Rest of String')

```

This writes a file in App\\Plugins called map.php. If this file already exists nothing happens.

If your map.php file was this

```

```

The blade file would replace \[\[- map -\]\] and output

```
Your string Map. Rest of String

```

Use Case
--------

[](#use-case)

1. Your user can update their contact page with basic text but you don't want to allow iframes. You can still allow them to enter \[\[- googlemap -\]\] to inject the google map html required to embed a map.
2. You have code that can spit out a list of links from the database. You also have basic pages on the site that allow the user to update their content and they can include the list code without having access to the actual code by simply entering \[\[- linklist -\]\].

Potential pitfall
-----------------

[](#potential-pitfall)

You plugin file can be all html but if it has php you need to echo the result. If you return it nothing will display. ie.

```

```

###  Health Score

28

—

LowBetter than 51% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Total

4

Last Release

1541d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3229763?v=4)[Dan](/maintainers/dnabeast)[@dnabeast](https://github.com/dnabeast)

---

Top Contributors

[![dnabeast](https://avatars.githubusercontent.com/u/3229763?v=4)](https://github.com/dnabeast "dnabeast (17 commits)")

---

Tags

pluginblade

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dnabeast-tusk/health.svg)

```
[![Health](https://phpackages.com/badges/dnabeast-tusk/health.svg)](https://phpackages.com/packages/dnabeast-tusk)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.7M3.4k](/packages/craftcms-cms)[moonshine/moonshine

Laravel administration panel

1.3k268.2k88](/packages/moonshine-moonshine)[tallstackui/tallstackui

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

731189.9k16](/packages/tallstackui-tallstackui)[hasinhayder/tyro-dashboard

Tyro Dashboard - Beautiful admin dashboard for managing Tyro roles, privileges, users, and settings

5495.1k](/packages/hasinhayder-tyro-dashboard)[technikermathe/blade-lucide-icons

A package to easily make use of Lucide icons in your Laravel Blade views.

18473.9k13](/packages/technikermathe-blade-lucide-icons)[hasinhayder/tyro-login

Tyro Login - Beautiful, customizable authentication views for Laravel 12 &amp; 13

2488.1k7](/packages/hasinhayder-tyro-login)

PHPackages © 2026

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