Add cs fixer and first controller with route /.

This commit is contained in:
Krzysztof Płaczek
2024-10-16 16:34:55 +02:00
parent 8d18667263
commit 718855aaf6
6 changed files with 99 additions and 4 deletions

4
.gitignore vendored
View File

@@ -9,3 +9,7 @@
/vendor/
###< symfony/framework-bundle ###
.idea
###> php-cs-fixer/shim ###
/.php-cs-fixer.php
/.php-cs-fixer.cache
###< php-cs-fixer/shim ###

13
.php-cs-fixer.dist.php Normal file
View File

@@ -0,0 +1,13 @@
<?php
$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
->exclude('var')
;
return (new PhpCsFixer\Config())
->setRules([
'@Symfony' => true,
])
->setFinder($finder)
;

View File

@@ -7,6 +7,7 @@
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"php-cs-fixer/shim": "^3.64",
"symfony/console": "7.1.*",
"symfony/dotenv": "7.1.*",
"symfony/flex": "^2",
@@ -14,8 +15,6 @@
"symfony/runtime": "7.1.*",
"symfony/yaml": "7.1.*"
},
"require-dev": {
},
"config": {
"allow-plugins": {
"php-http/discovery": true,

54
composer.lock generated
View File

@@ -4,8 +4,60 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "50f9c0973acafa44bb359f58b30b8e58",
"content-hash": "6f438d4470aff3ca26ab7be26faa0b50",
"packages": [
{
"name": "php-cs-fixer/shim",
"version": "v3.64.0",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/shim.git",
"reference": "81ccfd24baf3a10810dab1152c403981a790b837"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/81ccfd24baf3a10810dab1152c403981a790b837",
"reference": "81ccfd24baf3a10810dab1152c403981a790b837",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-tokenizer": "*",
"php": "^7.4 || ^8.0"
},
"replace": {
"friendsofphp/php-cs-fixer": "self.version"
},
"suggest": {
"ext-dom": "For handling output formats in XML",
"ext-mbstring": "For handling non-UTF8 characters."
},
"bin": [
"php-cs-fixer",
"php-cs-fixer.phar"
],
"type": "application",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Dariusz Rumiński",
"email": "dariusz.ruminski@gmail.com"
}
],
"description": "A tool to automatically fix PHP code style",
"support": {
"issues": "https://github.com/PHP-CS-Fixer/shim/issues",
"source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.64.0"
},
"time": "2024-08-30T23:10:11+00:00"
},
{
"name": "psr/cache",
"version": "3.0.0",

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class MainController
{
#[Route('/', name: 'main')]
public function homepage(): Response
{
return new Response('Hello World!');
}
}

View File

@@ -1,4 +1,16 @@
{
"php-cs-fixer/shim": {
"version": "3.64",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "3.0",
"ref": "16422bf8eac6c3be42afe07d37e2abc89d2bdf6b"
},
"files": [
".php-cs-fixer.dist.php"
]
},
"symfony/console": {
"version": "7.1",
"recipe": {