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 3w 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

29

—

LowBetter than 57% of packages

Maintenance30

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

1496d 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.6M2.9k](/packages/craftcms-cms)[tightenco/jigsaw

Simple static sites with Laravel's Blade.

2.3k449.3k30](/packages/tightenco-jigsaw)[robsontenorio/mary

Gorgeous UI components for Livewire powered by daisyUI and Tailwind

1.5k531.0k21](/packages/robsontenorio-mary)[hasinhayder/tyro-dashboard

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

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

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

18379.7k9](/packages/technikermathe-blade-lucide-icons)[secondnetwork/blade-tabler-icons

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

36594.8k24](/packages/secondnetwork-blade-tabler-icons)

PHPackages © 2026

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