Survival kit for your proof of concepts & quick n dirty tests :
- Start a PHP project in 10 seconds flat
- Feel like Symfony 6 but without model, entity, database config, form class...
- Form-driven development
- The POC is validated ? Now you can extract entity informations for the final project built on Symfony 6
- No security at all, not intended for production AT ALL.
It includes :
- PHP 8.1
- Symfony Kernel & HttpFoundation 6.3
- Symfony Forms with Validators & CSRF
- Twig 3.x
- MongoDb 6.0
- PicoCSS because it's the best CSS framework
- AlpineJS because of climate change
- PhpUnit 9.x
$ docker compose build && docker compose up
$ firefox http://127.0.0.1:8000/
$ docker exec -it bronze-symfony-1 vendor/bin/phpunit
$ docker exec -it bronze-mongo-1 mongosh
$app = new BusinessApp();
// database name : bronze
// entity name and collection name : bicycle
$app->crud('bronze', 'bicycle', function (FormBuilderInterface $builder) {
return $builder
->add('brand', TextType::class)
->add('size', TextType::class)
->add('color', TextType::class)
->add('save', SubmitType::class)
->getForm();
});
$app->run();
This method adds 5 routes :
/bicycle
for list/bicycle/new/create
for creating a new bicycle/bicycle/1234/show
for viewing bicycle 1234/bicycle/1234/edit
for editing bicycle 1234/bicycle/1234/delete
for deleting bicycle 1234
It uses a entity with magic accessors/mutators but you can use your own entity, your own form and your own routes.
Homepage '/' with a template index.html.twig
stored in ./templates
:
$app = new \Trismegiste\Bronze\Core\WebApp();
$app->get('/', function () {
return $this->render('index.html.twig', ['message' => 'Hi Mom !']);
});
$app->run();
$app = new Trismegiste\Bronze\Core\App();
$app->get('/', function () {
return new \Symfony\Component\HttpFoundation\JsonResponse(['message' => 'Hi Mom !']);
});
$app->run();
All controllers are Closures but they are bound to feel like you're using a AbstractController from Symfony.
Customize templates in ./templates/bicycle
for the entity name bicycle :
- list.html.twig
- show.html.twig
- form.html.twig
- create.html.twig
- edit.html.twig
- delete.html.twig
If one of these template does not exist, twig falls back to generic templates in ./Resources/templates