chat-agency / laravel-backend-component
Use Laravel component using php classes
Fund package maintenance!
Chat Agency
Requires
- php: ^8.2
- illuminate/contracts: ^10.0||^11.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^9.0.0||^8.22.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.3
- phpunit/phpunit: ^11.3
- dev-main
- v0.10.5
- v0.10.4
- v0.10.3
- v0.10.2
- v0.10.1
- v0.10.0
- v0.9.3
- v0.9.2
- v0.9.1
- v0.9.0
- v0.8.7
- v0.8.6
- v0.8.5
- v0.8.4
- v0.8.3
- v0.8.2
- v0.8.1
- v0.8.0
- v0.7.0
- v0.6.1
- v0.6.0
- v0.5.0
- v0.4.1
- v0.4.0
- v0.3.1
- v0.3.0
- v0.2.1
- v0.2.0
- v0.1.0
- dev-new-components
- dev-more-chores
- dev-chores
- dev-new-component
- dev-additional-tests
- dev-fixes
- dev-refactor
- dev-tests
- dev-local-theme-manager-fix
- dev-table-util
- dev-develop
This package is auto-updated.
Last update: 2025-05-16 22:18:39 UTC
README
A package that simplifies the creation of Laravel components using PHP classes.
Installation
Install the package via Composer:
composer require chat-agency/laravel-backend-component
To use the package’s Tailwind
themes, add the assets’ path to the configuration file:
export default { content: [ './vendor/chat-agency/laravel-backend-component/resources/views/**/*.blade.php', // <- this line // other paths ], // ... };
Basic use
Use the MainBackendComponent class to construct your component. Pass the component name/path as the first parameter:
use ChatAgency\BackendComponents\MainBackendComponent; $button = new MainBackendComponent("inline.button");
Alternatively, builders and an enum are available to streamline instance creation:
use ChatAgency\BackendComponents\Enums\ComponentEnum; use ChatAgency\BackendComponents\MainBackendComponent; $button = ComponentBuilder::make(ComponentEnum::BUTTON);
Since the main component class implements Laravel’s Htmlable interface, you can output the component using simple Blade syntax—no escaping needed:
{{ $button }}
Tailwind Theming
The package also supports theming, primarily for Tailwind classes.
All themes are stored inside resources/views/
by default, ensuring seamless Tailwind class discovery
use ChatAgency\BackendComponents\Enums\ComponentEnum; use ChatAgency\BackendComponents\MainBackendComponent; $button = ComponentBuilder::make(ComponentEnum::BUTTON) ->setTheme('theme_file', 'theme_name');
Tests
Run tests using Composer:
composer test
If you're submitting a pull request, use the qa
command—it runs phpstan
, pint
, and tests
. These are the same checks performed in GitHub Actions
composer qa
License
This package is licensed under the MIT License.