PHPackages                             erickcomp/laravel-raw-blade-components - 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. [Framework](/categories/framework)
4. /
5. erickcomp/laravel-raw-blade-components

ActivePackage[Framework](/categories/framework)

erickcomp/laravel-raw-blade-components
======================================

Provides the possibility to create and use blade components syntax with arbitrary code

2.0.0(today)00MITPHPPHP ^8.2

Since Mar 5Pushed today1 watchersCompare

[ Source](https://github.com/erickcomp/laravel-raw-blade-components)[ Packagist](https://packagist.org/packages/erickcomp/laravel-raw-blade-components)[ RSS](/packages/erickcomp-laravel-raw-blade-components/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (3)Used By (0)

laravel-raw-blade-components
============================

[](#laravel-raw-blade-components)

> Register raw Blade component tags and compile them into arbitrary opening / closing / self-closing code snippets.

[![PHP](https://camo.githubusercontent.com/e2df0db5111cc996698331f261bf2635d5d982b997163dd61bcd20b2f000f216/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d3838393242462e737667)](https://www.php.net/) [![License: MIT](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE) [![Packagist Version](https://camo.githubusercontent.com/f4d8dc43131e38978b3a2cb2d5fa9c37e95f4dd4eb8b4312ad63a2711d733bb3/68747470733a2f2f62616467652d706c616365686f6c6465722e696e76616c69642f7061636b6167697374)](https://packagist.org/) [![Tests](https://camo.githubusercontent.com/b7f342f05721620c273e2a0aa1fdcf5259e2cd5f9cb660b5f7a5081531e16488/68747470733a2f2f62616467652d706c616365686f6c6465722e696e76616c69642f7465737473)](https://github.com/)

This tiny package allows you to register "raw" Blade component tags (for example `` or prefix tags such as ``) and map them to arbitrary opening, closing and self-closing snippets that will be injected into templates at Blade compile time.

Table of contents

- Features
- Requirements
- Installation
- Configuration
- Usage (basic)
- Usage (advanced / prefix-matching)
- Public API
- Internals &amp; Notes
- Testing
- Contributing
- License

Features
--------

[](#features)

- Register exact component tags and prefix-based tags and map them to arbitrary output snippets.
- Support for non-self-closing and self-closing usage.
- Preserves nested contexts using an internal stack so nested raw components work predictably.
- Uses Laravel's `ComponentTagCompiler` for attribute parsing and escaping semantics.
- Auto-discovered service provider — no manual provider registration required.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 12.60+ or 13.10+

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

[](#installation)

Install with Composer (replace with real package name after publishing):

```
composer require erickcomp/laravel-raw-blade-components
```

The service provider is auto-discovered. If you need to register it manually, add the provider to `config/app.php`:

```
ErickComp\RawBladeComponents\RawBladeComponentsServiceProvider::class,
```

Configuration
-------------

[](#configuration)

There is no published configuration file. You register raw components programmatically from a service provider (for example in `App\Providers\AppServiceProvider::boot`).

Usage (basic)
-------------

[](#usage-basic)

Register a component that replaces an `` tag with custom opening/closing snippets:

```
use ErickComp\RawBladeComponents\RawComponent;

RawComponent::rawComponent(
    'x-badge',
    '',    // opening snippet
    '',                   // closing snippet
    '',  // optional self-closing snippet
    ['class' => 'badge-default'] // optional default attributes
);
```

Now a Blade string like `Hi` will be compiled into your opening snippet + `Hi` + closing snippet.

Usage (prefix-based / advanced matching)
----------------------------------------

[](#usage-prefix-based--advanced-matching)

Register components that match tags starting with a prefix (useful for namespaced tags or tags containing dynamic suffixes):

```
RawComponent::rawComponentStartingWith(
    'x-alert',
    '',
    '',
    ''
);

// Matches tags such as  and
```

Prefix registrations are sorted so longer/more-specific prefixes match first.

Error cases
-----------

[](#error-cases)

- Using a self-closing tag when no self-closing snippet was registered for that component will throw a `LogicException`, which is surfaced as an `Illuminate\View\ViewException` when rendering (see tests).

Public API
----------

[](#public-api)

- Facade: `ErickComp\RawBladeComponents\RawComponent`

    - `rawComponent(string $tag, string $openingCode, string $closingCode, ?string $selfClosingCode = null, array $defaultAttributes = [])`
    - `rawComponentStartingWith(string $tag, string $openingCode, string $closingCode, ?string $selfClosingCode = null, array $defaultAttributes = [])`
    - `compileRawBladeComponents(string $templateStr): string`
- Manager: `ErickComp\RawBladeComponents\RawComponentsManager` (registered as a singleton)

Internals &amp; notes
---------------------

[](#internals--notes)

- The package registers its compiler via `Blade::prepareStringsForCompilationUsing(...)` in the service provider so it runs during Blade's compile process.
- Internally, the generated template code maintains a small stack using the following internal variables:
    - `$__rawComponentsStack`, `$__rawComponentTagPrefix`, `$__rawComponentTag`, `$__rawComponentAttributes`.

These variables are implementation details and should be considered private.

Limitations
-----------

[](#limitations)

- No configuration, published assets, migrations or CLI commands are provided.
- Attribute handling follows Laravel's `ComponentTagCompiler`, but the test coverage for complex attribute/binding scenarios is limited — please validate attribute behavior in your application if you rely on bound attributes or complex directives.

Testing
-------

[](#testing)

This package uses Pest and Orchestra Testbench for integration tests. Run the tests locally:

```
composer install --dev
./vendor/bin/pest
```

Contributing
------------

[](#contributing)

See `CONTRIBUTING.md` for contribution guidelines.

License
-------

[](#license)

MIT — see LICENSE file.

Credits
-------

[](#credits)

Author and contributors are listed in the repository metadata.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

Total

2

Last Release

0d ago

Major Versions

1.0.0 → 2.0.02026-06-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/595191205f313fecae9e4099f07cbac347fc3a27b8a9f553ac2be50e97c35730?d=identicon)[erickcomp](/maintainers/erickcomp)

---

Top Contributors

[![erickcomp](https://avatars.githubusercontent.com/u/12174550?v=4)](https://github.com/erickcomp "erickcomp (16 commits)")

---

Tags

frameworklaravelbladecomponent

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/erickcomp-laravel-raw-blade-components/health.svg)

```
[![Health](https://phpackages.com/badges/erickcomp-laravel-raw-blade-components/health.svg)](https://phpackages.com/packages/erickcomp-laravel-raw-blade-components)
```

###  Alternatives

[laravel/laravel

The skeleton application for the Laravel framework.

84.5k62.4M1.0k](/packages/laravel-laravel)[unopim/unopim

UnoPim Laravel PIM

10.3k2.2k](/packages/unopim-unopim)[nasirkhan/laravel-starter

A CMS like modular Laravel starter project.

1.4k2.7k](/packages/nasirkhan-laravel-starter)[kompo/kompo

Laravel &amp; Vue.js FullStack Components for Rapid Application Development

11914.4k42](/packages/kompo-kompo)[codewithdennis/larament

Larament is a time-saving starter kit to quickly launch Laravel 13.x projects. It includes FilamentPHP 5.x pre-installed and configured, along with additional tools and features to streamline your development workflow.

3861.7k](/packages/codewithdennis-larament)[ercogx/laravel-filament-starter-kit

This is a Filament v5 Starter Kit for Laravel 13, designed to accelerate the development of Filament-powered applications.

441.7k](/packages/ercogx-laravel-filament-starter-kit)

PHPackages © 2026

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