A way to build encapsulated components (colocated HTML, CSS and JS) in PHP. (Every Javascript framework is embracing server-side rendering, so why not just skip straight to PHP?)
Don't. It's not on Packagist yet. I'm using an in-progress version of the Cavatappi framework to build this. Once I get this and that uploaded to Packagist, it'll be simpler. Until then:
- Add this repo to your
composer.json:
[
{
"type": "vcs",
"url": "https://github.com/oddevan/capsule-ui"
}
]- Add this to your
composer.json:
"oddevan/capsule-ui": "dev-main"More detailed writeup to come, but basically call oddEvan\CapsuleUi\CapsuleUi::createRegistry with the
preferred modules, then use the ComponentRegistry to render:
$registry = new oddEvan\CapsuleUi\CapsuleUi::createRegistry(oddEvan\UI\Module::class);
$registry->render(
'card',
headline: 'Headline',
description: 'This is a card.',
submitButtonText: 'Cool!'
);(Currently AGPL, subject to change as project matures.)
Capsule UI by oddEvan Copyright (C) 2025 Evan Hildreth
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.