strangebuzz/microsymfony

A template to initialize an application to use Symfony as a micro-framework

Installs: 61

Dependents: 0

Suggesters: 0

Security: 0

Stars: 87

Watchers: 1

Forks: 8

Open Issues: 12

Type:symfony-application-template


README

Latest Version PHP Version Require level Software License Build Status (GitHub) Code Coverage Scrutinizer Code Quality Quality Score

About ๐Ÿ–‹

MicroSymfony is a Symfony 7.1 application skeleton on steroids, ready to use.

I have made a long blog post explaining all it contains; it will be the reference for documentation. I'll update it when needed:

If you want to use the last Symfony 6.4 LTS version in your composer.json file, replace all occurrences of 7.1 with 6.4 and run composer up.

Table of Contents ๐Ÿ“–

Demos ๐ŸŒˆ

Because a live demo is always better than all explanations:

Quick-start โšก

With the Symfony binary ๐ŸŽถ

You must have the Symfony binary and composer installed locally.

To create a new project from the GitHub template, run:

composer create-project strangebuzz/microsymfony && cd microsymfony

Then start the PHP server with make:

make start

Or with Castor:

castor start

Open https://127.0.0.1:8000 (considering your 8000 port is free) and enjoy! ๐Ÿ™‚

With FrankenPHP ๐ŸงŸโ€

We can also use FrankenPHP to run MicroSymfony. You must have Docker installed locally.

Create a new project from the GitHub template, run:

docker run --rm -it -v $PWD:/app composer:latest create-project strangebuzz/microsymfony && cd microsymfony

Install the FrankenPHP Symfony runtime:

docker run --rm -it -v $PWD:/app composer:latest require runtime/frankenphp-symfony

Then run:

docker run \
    -e FRANKENPHP_CONFIG="worker ./public/index.php" \
    -e APP_RUNTIME=Runtime\\FrankenPhpSymfony\\Runtime \
    -v $PWD:/app \
    -p 80:80 -p 443:443 \
    -d \
    dunglas/frankenphp

Open https://localhost and enjoy! ๐Ÿ™‚

PS: On Windows, replace $PWD with "%cd%".

You can also directly use the FrankenPHP branch.

Requirements โš™

Optional requirements โš™

  • The Xdebug PHP extension if you want to run the code coverage report
  • Castor task runner if you don't want to use Make and its Makefile

Stack ๐Ÿ”—

PS: A fork of BareCSS was created to fix some issues as the project is not maintained anymore.

Features ๐Ÿš€

MicroSymfony ships these features, ready to use:

Feature branches ๐Ÿš…

Feature branches are not merged in the main branch but are used to test the integration of a new vendor library or make a POC. For example, have you ever dreamed of testing Eloquent, the Laravel ORM, on a Symfony project? Then clone the eloquent branch and run composer install && make load-fixtures.

Infrastructure

  • FrankenPHP (PR, branch, rebased on 2024-11-17)
  • Symfony-docker (PR, branch, rebased on 2024-11-17)

Database ๐Ÿ’ฝ

These ยซ database ยป branches aim to display a list of records coming from a SQLite database.

  • Doctrine DBAL (PR, branch, rebased on 2024-11-17)
  • Eloquent ORM (PR, branch, rebased on 2024-11-17)

Tooling ๐Ÿ”จ

  • Taskfile (PR, branch, rebased on 2024-11-17)
  • TwigStan (PR, branch, rebased on 2024-11-17)

These branches will be rebased after each release so they are always up to date.

Notes ๐Ÿ“’

Turbo forms are disabled in assets/app.js. To enable the feature for a given form, add the data-turbo="true" attribute to it. Or change the parameter Turbo.setFormMode to on to activate the feature globally. In both cases, your controller code has to be modified accordingly.

Other good practices ๐Ÿ‘Œ

References ๐Ÿ“š

Contributing ๐Ÿค

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security ๐Ÿงฏ

Please see SECURITY for details.

Credits ๐Ÿ™

License โš–๏ธ

The MIT License (MIT). Please see License File for more information.