PHPackages                             stuartcusackie/cdom - 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. stuartcusackie/cdom

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

stuartcusackie/cdom
===================

Add classes to markup in a Laravel project.

1.0.17(6mo ago)0161MITPHPPHP ^7.4 || ^8.0

Since Nov 14Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/stuartcusackie/cdom)[ Packagist](https://packagist.org/packages/stuartcusackie/cdom)[ RSS](/packages/stuartcusackie-cdom/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (19)Used By (0)

SCIE CDOM
=========

[](#scie-cdom)

A helper function that adds classes to elements in html strings. Useful for Tailwind projects. Designed for Laravel.

Installation
------------

[](#installation)

```
composer require stuartcusackie/cdom

```

Publish
-------

[](#publish)

```
php artisan vendor:publish

```

Tailwind Purge
--------------

[](#tailwind-purge)

Tailwind will need to know about this cdom config file so that classes are maintained in the purge.

```
content: [
  ...
  './config/cdom.php'
],

```

Config
------

[](#config)

You can set up multiple styles for your application.

**Example style config**

```
'style1' => [
	'a' => 'underline text-blue-500 hover:text-blue-900 visited:text-blue-900',
	'h1' => 'text-5xl 2xl:text-6xl font-display font-bold mb-12 text-highlight-primary',
	'h2' => 'text-4xl 2xl:text-5xl font-display font-semibold mb-8 mt-12 first:mt-0',
	'h3' => 'text-3xl 2xl:text-4xl font-display font-semibold mb-6 mt-12 first:mt-0',
	'h4' => 'text-2xl 2xl:text-3xl mb-6',
	'h5' => 'text-xl 2xl:text-2xl font-semibold mb-4',
	'ul' => 'pl-5 list-disc',
	'ol' => 'pl-5 list-decimal',
	'li' => 'mb-2 last:mb-0',
	'p, ul, ol, table' => 'mb-4 last:mb-0',
	'blockquote' => 'border-l-8 p-3 mb-5 text-xl border-gray-200',
	'table' => 'w-full border-r text-left border-gray-200',
	'table tbody' => 'border-t border-gray-200',
	'table tr' => 'border-b border-gray-200 odd:bg-gray-100',
	'table td, table th' => 'border-l px-3 py-1 border-gray-200',
	'table th' => 'odd:bg-gray-200'
]

```

Usage
-----

[](#usage)

To transform markup use the `cdom` helper. You can optionally pass a style name from your config or let it fall back to the default. You can also pass an array of overrides.

```
{!! cdom($content) !!}
{!! cdom($content, 'yourconfigstylename') !!}

```

To get the classes for a single HTML element from your style config you can use the `cdomel` helper. You can optionally pass a style name from your config or let it fall back to the default:

```
Heading
Link

```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance66

Regular maintenance activity

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Recently: every ~314 days

Total

18

Last Release

206d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9b3b7f67ae3b509c07e97c7bf803427ae0965adeed933daa02bffc2a37c08333?d=identicon)[stuartcusackie](/maintainers/stuartcusackie)

---

Top Contributors

[![stuartcusackie](https://avatars.githubusercontent.com/u/20210934?v=4)](https://github.com/stuartcusackie "stuartcusackie (29 commits)")

### Embed Badge

![Health badge](/badges/stuartcusackie-cdom/health.svg)

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

###  Alternatives

[bensampo/laravel-embed

Painless responsive embeds for videos, slideshows and more.

142146.8k](/packages/bensampo-laravel-embed)

PHPackages © 2026

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