Skip to content

Commit

Permalink
readme: summary
Browse files Browse the repository at this point in the history
  • Loading branch information
COil committed Aug 8, 2023
1 parent 4c87f1a commit 863c1f1
Showing 1 changed file with 37 additions and 118 deletions.
155 changes: 37 additions & 118 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
# MicroSymfony 🎶

MicroSymfony is a template to initialize an application to use Symfony as a micro-framework.
MicroSymfony is a Symfony application skeleton on steroids, ready to use.

It can be used to create a POC or prototype something without having to take care
of the design while having something still enjoyable (and fit to be seen).
I have made a long blog post explaining all it contains, this will be the reference
for documentation, and I'll update it when needed:

Even if it is minimalist, the quality isn't sacrificed.
There are tests (100% coverage) and CS checks: php-cs-fixer+PHPStan.
All this is checked with a GitHub actions workflow.

It's not really intended to be used in production, use a your own risks.
Well, at least you should remove the classless framework to use a modern CSS framework.

If you like it, don't forget to add a [](https://github.com/strangebuzz/MicroSymfony)
please.

PR are of course welcome if you think something can be fixed or improved.
* https://www.strangebuzz.com/en/blog/introducing-the-microsymfony-application-template (🇬🇧)


## Demo 🌈
Expand All @@ -25,20 +15,12 @@ Because a live demo is always better than all explanations. Here is it:
* Live demo at [https://microsymfony.ovh](https://microsymfony.ovh)


## Todo 🖋


## To try/test 💡

* try dropin minimal: https://github.com/dohliam/dropin-minimal-css


## Requirements ⚙

* [PHP 8.1](https://www.php.net/releases/8.1/en.php)
* [PHP 8.1](https://www.php.net/releases/8.1/en.php) (works with [PHP 8.2](https://github.com/strangebuzz/MicroSymfony/actions/runs/5793881686/job/15702426339))
* The [Symfony CLI](https://symfony.com/download)
* The [Xdebug](https://xdebug.org/) PHP extension if you want to run the code coverage report

* The [Xdebug](https://xdebug.org/) PHP extension if you want to run the code coverage report (optional)
* [Castor 0.7](https://github.com/jolicode/castor) task runner (optional)

## Stack 🔗

Expand All @@ -49,15 +31,35 @@ Because a live demo is always better than all explanations. Here is it:
* The classless [BareCSS](http://barecss.com) CSS framework


## Barecss forks 🎨

* https://github.com/zonradkuse


## What does it ship? 🚀

* A [demo with some JavaScript and Stimulus using the new Sf 6.3 asset mapper component](https://github.com/strangebuzz/MicroSymfony/blob/main/templates/stimulus.html.twig)
* A [default error page extending the base layout](https://github.com/strangebuzz/symfony-micro/blob/main/templates/bundles/TwigBundle/Exception/error.html.twig)
## Features 🚀

**MicroSymfony** ships these features, ready to use:

* A task runner
* Make ([source](https://github.com/strangebuzz/MicroSymfony/blob/main/Makefile)) ([demo](https://www.strangebuzz.com/en/blog/introducing-the-microsymfony-application-template#h3_4_1))
* Castor ([source](https://github.com/strangebuzz/MicroSymfony/blob/main/castor.php)) ([demo](https://www.strangebuzz.com/en/blog/introducing-the-microsymfony-application-template#h3_4_2))
* Static analysis with PHPStan
* [Configuration](https://github.com/strangebuzz/MicroSymfony/blob/main/phpstan.neon)
* Coding standards with php-cs-fixer
* [Configuration](https://github.com/strangebuzz/MicroSymfony/blob/main/.php-cs-fixer.dist.php)
* Tests ([demo](https://www.strangebuzz.com/en/blog/introducing-the-microsymfony-application-template#h2_7))
* Unit test [example](https://github.com/strangebuzz/MicroSymfony/tree/main/tests/Unit/Helper)
* Integration test [example](https://github.com/strangebuzz/MicroSymfony/blob/main/tests/Integration/Twig/Extension/ResponseExtensionTest.php)
* Functional test [example](https://github.com/strangebuzz/MicroSymfony/blob/main/tests/Functional/Controller/AppControllerTest.php)
* API test [example](https://github.com/strangebuzz/MicroSymfony/blob/main/tests/Api/Controller/SlugifyActionTest.php)
* E2E test [example](https://github.com/strangebuzz/MicroSymfony/blob/main/tests/E2E/Controller/AppControllerTest.php)
* Code coverage at 100%
* [Output on CI](https://github.com/strangebuzz/MicroSymfony/actions/runs/5793881686/job/15702426150)
* [Failing output example](https://github.com/strangebuzz/MicroSymfony/actions/runs/5220428064/jobs/9423476258)
* GitHub CI
* [Tests job output](https://github.com/strangebuzz/MicroSymfony/actions/runs/5793881686/job/15702426150)
* [Lint job output](https://github.com/strangebuzz/MicroSymfony/actions/runs/5793881686/job/15702425939)
* Asset mapper+Stimulus
* Vanilla Js ([source](https://github.com/strangebuzz/MicroSymfony/blob/main/assets/controllers/hello_controller.js)) ([demo](https://microsymfony.ovh/stimulus))
* Fetch on a JSON endpoint of the application ([source](https://github.com/strangebuzz/MicroSymfony/blob/main/assets/controllers/api_controller.js)) ([demo](https://microsymfony.ovh/stimulus))
* A custom error template
* [Source](https://github.com/strangebuzz/MicroSymfony/blob/main/templates/bundles/TwigBundle/Exception/error.html.twig)
* [Demo](https://microsymfony.ovh/404)


## What it doesn't ship? ❌
Expand All @@ -66,89 +68,6 @@ Because a live demo is always better than all explanations. Here is it:
* Doctrine


## Installation & first run 🚀

composer install

Start the web server:

make start

Or with [Castor](https://github.com/jolicode/castor):

castor symfony:start


Then open [https://127.0.0.1:8000](https://127.0.0.1:8000)

The port can change if `8000` is already used.


## Tests ✅

Run tests with:

vendor/bin/simple-phpunit

Using composer:

composer app:test

Using the Makefile:

make test

Using the [Castor](https://github.com/jolicode/castor):

castor test:all

Make your choice! ✅


## Code coverage ♻️

The code coverage is at 100% and is analysed with a simple script
(thanks [Ocramius](https://ocramius.github.io/blog/automated-code-coverage-check-for-github-pull-requests-with-travis/)).

For instance, in the following build, the code coverage analysis fails because the
code coverage is 95.35% which is the below the wanted threshold of 100%.

https://github.com/strangebuzz/MicroSymfony/actions/runs/5220428064/jobs/9423476258

The default threshold is 100%, you can change it in the [GitHub actions file](.github/workflows/symfony.yml).

When the step runs, it fails if the current coverage is below the wanted threshold.
As simple as this.

To have the complete HTML report (xdebug must be activated), run:

make coverage

Or

castor test:coverage

Then open the report in your browser:

make cov-report

Or

castor test:cov-report


## Dev-tools ✨

* php-cs-fixer with the [Symfony ruleset and PHP strict types](https://github.com/strangebuzz/MicroSymfony/blob/main/.php-cs-fixer.dist.php)
* PHPStan at [maximum level](https://github.com/strangebuzz/MicroSymfony/blob/main/phpstan.neon)
* [Castor task runner](https://github.com/strangebuzz/MicroSymfony/blob/main/castor.php)
* A simple [Makefile](https://github.com/strangebuzz/MicroSymfony/blob/main/Makefile)


## References 📚

* https://symfony.com/bundles/StimulusBundle/current/index.html
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap
* https://symfony.com/blog/new-in-symfony-6-3-assetmapper-component
* https://github.com/rails/importmap-rails#expected-errors-from-using-the-es-module-shim
* https://dohliam.github.io/dropin-minimal-css/?bare#text
* https://jolicode.com/blog/castor-a-journey-across-the-sea-of-task-runners

0 comments on commit 863c1f1

Please sign in to comment.