[Feature] Passage vers Symfony #1

Merged
Skitounet merged 10 commits from v2 into main 2025-01-10 20:39:09 +00:00
14 changed files with 465 additions and 21 deletions
Showing only changes of commit 17f36e59f9 - Show all commits

4
.gitignore vendored
View File

@ -28,3 +28,7 @@
.vscode/
.fleet/
*.iml
/uploads/*
!uploads/.gitkeep

View File

@ -1,16 +0,0 @@
import { Controller } from '@hotwired/stimulus';
/*
* This is an example Stimulus controller!
*
* Any element with a data-controller="hello" attribute will cause
* this controller to be executed. The name "hello" comes from the filename:
* hello_controller.js -> "hello"
*
* Delete this file or adapt it for your use!
*/
export default class extends Controller {
connect() {
this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';
}
}

View File

@ -1,3 +1,3 @@
body {
background-color: skyblue;
}
@tailwind base;
@tailwind components;
@tailwind utilities;

View File

@ -11,6 +11,8 @@
"doctrine/doctrine-bundle": "^2.13",
"doctrine/doctrine-migrations-bundle": "^3.3",
"doctrine/orm": "^3.3",
"league/flysystem": "^3.0",
"oneup/flysystem-bundle": "^4",
"phpdocumentor/reflection-docblock": "^5.6",
"phpstan/phpdoc-parser": "^2.0",
"symfony/asset": "7.2.*",
@ -42,6 +44,7 @@
"symfony/validator": "7.2.*",
"symfony/web-link": "7.2.*",
"symfony/yaml": "7.2.*",
"symfonycasts/tailwind-bundle": "^0.6.1",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0"
},

334
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "7fe141192d025e96fd12623b527e4e9a",
"content-hash": "c8e8b543137984b211315030412feaf7",
"packages": [
{
"name": "composer/semver",
@ -1377,6 +1377,194 @@
],
"time": "2024-12-27T00:36:43+00:00"
},
{
"name": "league/flysystem",
"version": "3.29.1",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
"reference": "edc1bb7c86fab0776c3287dbd19b5fa278347319"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/edc1bb7c86fab0776c3287dbd19b5fa278347319",
"reference": "edc1bb7c86fab0776c3287dbd19b5fa278347319",
"shasum": ""
},
"require": {
"league/flysystem-local": "^3.0.0",
"league/mime-type-detection": "^1.0.0",
"php": "^8.0.2"
},
"conflict": {
"async-aws/core": "<1.19.0",
"async-aws/s3": "<1.14.0",
"aws/aws-sdk-php": "3.209.31 || 3.210.0",
"guzzlehttp/guzzle": "<7.0",
"guzzlehttp/ringphp": "<1.1.1",
"phpseclib/phpseclib": "3.0.15",
"symfony/http-client": "<5.2"
},
"require-dev": {
"async-aws/s3": "^1.5 || ^2.0",
"async-aws/simple-s3": "^1.1 || ^2.0",
"aws/aws-sdk-php": "^3.295.10",
"composer/semver": "^3.0",
"ext-fileinfo": "*",
"ext-ftp": "*",
"ext-mongodb": "^1.3",
"ext-zip": "*",
"friendsofphp/php-cs-fixer": "^3.5",
"google/cloud-storage": "^1.23",
"guzzlehttp/psr7": "^2.6",
"microsoft/azure-storage-blob": "^1.1",
"mongodb/mongodb": "^1.2",
"phpseclib/phpseclib": "^3.0.36",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.5.11|^10.0",
"sabre/dav": "^4.6.0"
},
"type": "library",
"autoload": {
"psr-4": {
"League\\Flysystem\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Frank de Jonge",
"email": "info@frankdejonge.nl"
}
],
"description": "File storage abstraction for PHP",
"keywords": [
"WebDAV",
"aws",
"cloud",
"file",
"files",
"filesystem",
"filesystems",
"ftp",
"s3",
"sftp",
"storage"
],
"support": {
"issues": "https://github.com/thephpleague/flysystem/issues",
"source": "https://github.com/thephpleague/flysystem/tree/3.29.1"
},
"time": "2024-10-08T08:58:34+00:00"
},
{
"name": "league/flysystem-local",
"version": "3.29.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem-local.git",
"reference": "e0e8d52ce4b2ed154148453d321e97c8e931bd27"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/e0e8d52ce4b2ed154148453d321e97c8e931bd27",
"reference": "e0e8d52ce4b2ed154148453d321e97c8e931bd27",
"shasum": ""
},
"require": {
"ext-fileinfo": "*",
"league/flysystem": "^3.0.0",
"league/mime-type-detection": "^1.0.0",
"php": "^8.0.2"
},
"type": "library",
"autoload": {
"psr-4": {
"League\\Flysystem\\Local\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Frank de Jonge",
"email": "info@frankdejonge.nl"
}
],
"description": "Local filesystem adapter for Flysystem.",
"keywords": [
"Flysystem",
"file",
"files",
"filesystem",
"local"
],
"support": {
"source": "https://github.com/thephpleague/flysystem-local/tree/3.29.0"
},
"time": "2024-08-09T21:24:39+00:00"
},
{
"name": "league/mime-type-detection",
"version": "1.16.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/mime-type-detection.git",
"reference": "2d6702ff215bf922936ccc1ad31007edc76451b9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/2d6702ff215bf922936ccc1ad31007edc76451b9",
"reference": "2d6702ff215bf922936ccc1ad31007edc76451b9",
"shasum": ""
},
"require": {
"ext-fileinfo": "*",
"php": "^7.4 || ^8.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.2",
"phpstan/phpstan": "^0.12.68",
"phpunit/phpunit": "^8.5.8 || ^9.3 || ^10.0"
},
"type": "library",
"autoload": {
"psr-4": {
"League\\MimeTypeDetection\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Frank de Jonge",
"email": "info@frankdejonge.nl"
}
],
"description": "Mime-type detection for Flysystem",
"support": {
"issues": "https://github.com/thephpleague/mime-type-detection/issues",
"source": "https://github.com/thephpleague/mime-type-detection/tree/1.16.0"
},
"funding": [
{
"url": "https://github.com/frankdejonge",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/league/flysystem",
"type": "tidelift"
}
],
"time": "2024-09-21T08:32:55+00:00"
},
{
"name": "monolog/monolog",
"version": "3.8.1",
@ -1480,6 +1668,95 @@
],
"time": "2024-12-05T17:15:07+00:00"
},
{
"name": "oneup/flysystem-bundle",
"version": "4.12.3",
"source": {
"type": "git",
"url": "https://github.com/1up-lab/OneupFlysystemBundle.git",
"reference": "23d7186524a9c6236662c452891b1175cb193777"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/1up-lab/OneupFlysystemBundle/zipball/23d7186524a9c6236662c452891b1175cb193777",
"reference": "23d7186524a9c6236662c452891b1175cb193777",
"shasum": ""
},
"require": {
"league/flysystem": "^2.0 || ^3.0",
"php": "^8.1",
"symfony/config": "^5.4 || ^6.0 || ^7.0",
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
"symfony/http-kernel": "^5.4 || ^6.0 || ^7.0"
},
"require-dev": {
"ext-simplexml": "*",
"friendsofphp/php-cs-fixer": "^3.51",
"league/flysystem-async-aws-s3": "^2.0 || ^3.0",
"league/flysystem-aws-s3-v3": "^2.0 || ^3.0",
"league/flysystem-azure-blob-storage": "^3.0",
"league/flysystem-ftp": "^2.0 || ^3.0",
"league/flysystem-google-cloud-storage": "^2.0 || ^3.0",
"league/flysystem-memory": "^2.0 || ^3.0",
"league/flysystem-sftp-v3": "^2.0 || ^3.0",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.6.17",
"royvoetman/flysystem-gitlab-storage": "^2.0 || ^3.0",
"symfony/asset": "^5.4 || ^6.0 || ^7.0",
"symfony/browser-kit": "^5.4 || ^6.0 || ^7.0",
"symfony/finder": "^5.4 || ^6.0 || ^7.0",
"symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0",
"symfony/phpunit-bridge": "^7.0",
"symfony/translation": "^5.4 || ^6.0 || ^7.0",
"symfony/yaml": "^5.4 || ^6.0 || ^7.0"
},
"suggest": {
"ext-fileinfo": "Required for MimeType",
"ext-ftp": "Required for FTP and SFTP",
"league/flysystem-async-aws-s3": "Use flysystem S3 adapter from AsyncAws",
"league/flysystem-aws-s3-v3": "Use S3 storage with AWS SDK v3",
"league/flysystem-google-cloud-storage": "Use Google Cloud Storage Adapter for Flysystem",
"league/flysystem-sftp-v3": "Allows SFTP server storage via phpseclib",
"royvoetman/flysystem-gitlab-storage": "Use Gitlab Storage filesystem for Flysystem"
},
"type": "symfony-bundle",
"autoload": {
"psr-4": {
"Oneup\\FlysystemBundle\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jim Schmid",
"email": "js@1up.io",
"homepage": "https://1up.io",
"role": "Developer"
},
{
"name": "David Greminger",
"email": "dg@1up.io",
"homepage": "https://1up.io",
"role": "Developer"
}
],
"description": "Integrates Flysystem filesystem abstraction library to your Symfony project.",
"homepage": "https://1up.io",
"keywords": [
"Flysystem",
"abstraction",
"filesystem",
"symfony"
],
"support": {
"issues": "https://github.com/1up-lab/OneupFlysystemBundle/issues",
"source": "https://github.com/1up-lab/OneupFlysystemBundle/tree/4.12.3"
},
"time": "2024-10-15T06:27:06+00:00"
},
{
"name": "phpdocumentor/reflection-common",
"version": "2.2.0",
@ -7355,6 +7632,61 @@
],
"time": "2024-10-23T06:56:12+00:00"
},
{
"name": "symfonycasts/tailwind-bundle",
"version": "v0.6.1",
"source": {
"type": "git",
"url": "https://github.com/SymfonyCasts/tailwind-bundle.git",
"reference": "28db7cfe23758cffc79f25a7c75cdb2fca52e9d9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/SymfonyCasts/tailwind-bundle/zipball/28db7cfe23758cffc79f25a7c75cdb2fca52e9d9",
"reference": "28db7cfe23758cffc79f25a7c75cdb2fca52e9d9",
"shasum": ""
},
"require": {
"php": ">=8.1",
"symfony/asset-mapper": "^6.3|^7.0",
"symfony/cache": "^6.3|^7.0",
"symfony/console": "^5.4|^6.3|^7.0",
"symfony/http-client": "^5.4|^6.3|^7.0",
"symfony/process": "^5.4|^6.3|^7.0"
},
"require-dev": {
"phpunit/phpunit": "^9.6",
"symfony/filesystem": "^6.3|^7.0",
"symfony/framework-bundle": "^6.3|^7.0",
"symfony/phpunit-bridge": "^6.3.9|^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfonycasts\\TailwindBundle\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ryan Weaver",
"homepage": "https://symfonycasts.com"
}
],
"description": "Delightful Tailwind Support for Symfony + AssetMapper",
"keywords": [
"asset-mapper",
"tailwind"
],
"support": {
"issues": "https://github.com/SymfonyCasts/tailwind-bundle/issues",
"source": "https://github.com/SymfonyCasts/tailwind-bundle/tree/v0.6.1"
},
"time": "2024-11-06T18:41:22+00:00"
},
{
"name": "twig/extra-bundle",
"version": "v3.17.0",

View File

@ -13,4 +13,6 @@ return [
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfonycasts\TailwindBundle\SymfonycastsTailwindBundle::class => ['all' => true],
Oneup\FlysystemBundle\OneupFlysystemBundle::class => ['all' => true],
];

View File

@ -0,0 +1,10 @@
# Read the documentation: https://github.com/1up-lab/OneupFlysystemBundle
oneup_flysystem:
adapters:
default_adapter:
local:
location: "%kernel.project_dir%/uploads"
filesystems:
default_filesystem:
adapter: default_adapter
alias: League\Flysystem\Filesystem

View File

@ -0,0 +1,62 @@
<?php
namespace App\Controller;
use League\Flysystem\Filesystem;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpKernel\Attribute\MapQueryParameter;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\HttpFoundation\HeaderUtils;
class DashboardController extends AbstractController
{
#[Route('/', name: 'app_dashboard')]
public function index(Filesystem $defaultAdapter, UrlGeneratorInterface $urlGenerator): Response
{
$files = $defaultAdapter->listContents('/', Filesystem::LIST_DEEP);
$realFiles = [];
foreach ($files as $key => $file) {
if ($file['type'] === 'file' && !str_starts_with($file['path'], '.')) {
$realFiles[] = [
'path' => $file['path'],
'url' => $this->generateUrl('app_file_proxy', ['filename' => $file['path']], UrlGeneratorInterface::ABSOLUTE_URL),
];
}
}
return $this->render('dashboard/index.html.twig', [
'files' => $realFiles,
]);
}
#[Route('/file-proxy', name: 'app_file_proxy')]
public function fileProxy(Filesystem $defaultAdapter, #[MapQueryParameter('filename')]string $filename)
{
$mimetype = $defaultAdapter->mimeType($filename);
if ($mimetype === '') {
$mimetype = 'application/octet-stream';
}
$response = new StreamedResponse(static function () use ($filename, $defaultAdapter): void {
$outputStream = fopen('php://output', 'w');
$fileStream = $defaultAdapter->readStream($filename);
stream_copy_to_stream($fileStream, $outputStream);
});
$response->headers->set('Content-Type', $mimetype);
$disposition = HeaderUtils::makeDisposition(
HeaderUtils::DISPOSITION_ATTACHMENT,
basename($filename)
);
$response->headers->set('Content-Disposition', $disposition);
return $response;
}
}

View File

@ -26,6 +26,18 @@
"migrations/.gitignore"
]
},
"oneup/flysystem-bundle": {
"version": "4.12",
"recipe": {
"repo": "github.com/symfony/recipes-contrib",
"branch": "main",
"version": "4.0",
"ref": "3ae1b83985e89138f5443bbc2d9b8c074b497d49"
},
"files": [
"config/packages/oneup_flysystem.yaml"
]
},
"phpunit/phpunit": {
"version": "9.6",
"recipe": {
@ -296,6 +308,9 @@
"config/routes/web_profiler.yaml"
]
},
"symfonycasts/tailwind-bundle": {
"version": "v0.6.1"
},
"twig/extra-bundle": {
"version": "v3.17.0"
}

11
tailwind.config.js Normal file
View File

@ -0,0 +1,11 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./assets/**/*.js",
"./templates/**/*.html.twig",
],
theme: {
extend: {},
},
plugins: [],
}

View File

@ -2,7 +2,7 @@
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
<title>Kumora - {% block title %}Accueil{% endblock %}</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text><text y=%221.3em%22 x=%220.2em%22 font-size=%2276%22 fill=%22%23fff%22>sf</text></svg>">
{% block stylesheets %}
{% endblock %}
@ -12,6 +12,7 @@
{% endblock %}
</head>
<body>
{% include "partials/navbar.html.twig" %}
{% block body %}{% endblock %}
</body>
</html>

View File

@ -0,0 +1,14 @@
{% extends 'base.html.twig' %}
{% block title %}Dashboard{% endblock %}
{% block body %}
<div class="container mx-auto px-16">
<h1 class="text-center text-2xl font-bold">Bienvenue sur le dashboard</h1>
<ul class="list-disc">
{% for item in files %}
<li><a class="text-blue-500 hover:text-blue-700" href="{{ item.url }}">/{{ item.path }}</a></li>
{% endfor %}
</ul>
</div>
{% endblock %}

View File

@ -0,0 +1,6 @@
<nav>
<ul>
<li>Accueil</li>
<li>Liste des fichiers</li>
</ul>
</nav>

0
uploads/.gitkeep Normal file
View File