Compare commits

...

6 Commits

22 changed files with 2029 additions and 35 deletions

View File

@ -6,7 +6,7 @@
*/
// any CSS you import will output into a single css file (app.css in this case)
import './styles/app.css';
import './styles/app.scss';
// start the Stimulus application
import './bootstrap';
import './stimulus/bootstrap';

View File

@ -11,6 +11,6 @@ import { Controller } from '@hotwired/stimulus';
*/
export default class extends Controller {
connect() {
this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';
this.element.textContent = 'Hello Stimulus! Edit me in assets/stimulus/controllers/hello_controller.js';
}
}

View File

@ -0,0 +1 @@
$h1-font-size: 3.5rem; //bigger

View File

@ -1,3 +0,0 @@
body {
background-color: lightgray;
}

View File

@ -0,0 +1,16 @@
// override bootstrap variables
@import "_variables";
// import Bootstrap 5 styles
@import "~bootstrap/scss/bootstrap";
body {
//background-color: lightgray;
//padding: 3em;
div#boum {
//background-color: white;
padding: 1em;
border: 1px solid grey;
}
}

View File

@ -0,0 +1,21 @@
<template>
<div id="boum">
<div>hello <b>{{ username }}</b></div>
<div><b>{{ age }}</b> ans</div>
<input v-model="username">
</div>
</template>
<script>
export default {
name: 'app',
props: ['dataset'],
data() {
return {
user: this.dataset.user,
username: this.dataset.user.username,
age: this.dataset.user.age,
}
}
}
</script>

16
app/assets/vue/index.js Normal file
View File

@ -0,0 +1,16 @@
import { createApp } from 'vue'
import App from './components/App.vue'
const div = document.querySelector('div#app');
console.log(div);
const vue = createApp({
template: `<app :dataset="this.dataset" ></app>`,
data() {
return {
dataset: JSON.parse(div.dataset.app),
}
},
})
.component('app', App)
.mount('#app');

View File

@ -7,6 +7,7 @@
"php": ">=7.2.5",
"ext-ctype": "*",
"ext-iconv": "*",
"api-platform/core": "^2.7",
"doctrine/annotations": "^1.13",
"doctrine/doctrine-bundle": "^2.7",
"doctrine/doctrine-migrations-bundle": "^3.2",
@ -32,7 +33,8 @@
"symfony/web-link": "^5.4",
"symfony/webpack-encore-bundle": "^1.15",
"symfony/yaml": "^5.4",
"twig/twig": "^3.4"
"twig/twig": "^3.4",
"webonyx/graphql-php": "^14.11"
},
"config": {
"allow-plugins": {

396
app/composer.lock generated
View File

@ -4,8 +4,177 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "03cff0d8812e3e106effbb2da3b9eafd",
"content-hash": "dc5bf7b9c9c685633c33e2d86dd24ac4",
"packages": [
{
"name": "api-platform/core",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/api-platform/core.git",
"reference": "fbc076044413e80ef8360376ed4dc8b3c320375a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/api-platform/core/zipball/fbc076044413e80ef8360376ed4dc8b3c320375a",
"reference": "fbc076044413e80ef8360376ed4dc8b3c320375a",
"shasum": ""
},
"require": {
"doctrine/inflector": "^1.0 || ^2.0",
"php": ">=7.1",
"psr/cache": "^1.0 || ^2.0 || ^3.0",
"psr/container": "^1.0 || ^2.0",
"symfony/deprecation-contracts": "^2.1 || ^3.0",
"symfony/http-foundation": "^4.4 || ^5.1 || ^6.0",
"symfony/http-kernel": "^4.4 || ^5.1 || ^6.0",
"symfony/property-access": "^3.4.19 || ^4.4 || ^5.1 || ^6.0",
"symfony/property-info": "^3.4 || ^4.4 || ^5.2.1 || ^6.0",
"symfony/serializer": "^4.4 || ^5.1 || ^6.0",
"symfony/web-link": "^4.4 || ^5.1 || ^6.0",
"willdurand/negotiation": "^2.0.3 || ^3.0"
},
"conflict": {
"doctrine/common": "<2.7",
"doctrine/dbal": "<2.10",
"doctrine/mongodb-odm": "<2.2",
"doctrine/persistence": "<1.3",
"elasticsearch/elasticsearch": ">=8.0"
},
"require-dev": {
"behat/behat": "^3.1",
"behat/mink": "^1.9@dev",
"doctrine/annotations": "^1.7",
"doctrine/cache": "^1.11 || ^2.1",
"doctrine/common": "^2.11 || ^3.0",
"doctrine/data-fixtures": "^1.2.2",
"doctrine/dbal": "^2.6 || ^3.0",
"doctrine/doctrine-bundle": "^1.12 || ^2.0",
"doctrine/mongodb-odm": "^2.2",
"doctrine/mongodb-odm-bundle": "^4.0",
"doctrine/orm": "^2.6.4",
"elasticsearch/elasticsearch": "^7.11.0",
"friends-of-behat/mink-browserkit-driver": "^1.3.1",
"friends-of-behat/mink-extension": "^2.2",
"friends-of-behat/symfony-extension": "^2.1",
"guzzlehttp/guzzle": "^6.0 || ^7.0",
"jangregor/phpstan-prophecy": "^1.0",
"justinrainbow/json-schema": "^5.2.1",
"phpdocumentor/reflection-docblock": "^3.0 || ^4.0 || ^5.1",
"phpdocumentor/type-resolver": "^0.3 || ^0.4 || ^1.4",
"phpspec/prophecy": "^1.10",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.1",
"phpstan/phpstan-doctrine": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-symfony": "^1.0",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"ramsey/uuid": "^3.7 || ^4.0",
"ramsey/uuid-doctrine": "^1.4",
"soyuka/contexts": "dev-main",
"soyuka/stubs-mongodb": "^1.0",
"symfony/asset": "^3.4 || ^4.4 || ^5.1 || ^6.0",
"symfony/browser-kit": "^4.4 || ^5.1 || ^6.0",
"symfony/cache": "^3.4 || ^4.4 || ^5.1 || ^6.0",
"symfony/config": "^3.4 || ^4.4 || ^5.1 || ^6.0",
"symfony/console": "^3.4 || ^4.4 || ^5.1 || ^6.0",
"symfony/css-selector": "^3.4 || ^4.4 || ^5.1 || ^6.0",
"symfony/debug": "^3.4 || ^4.4 || ^5.1 || ^6.0",
"symfony/dependency-injection": "^3.4 || ^4.4 || ^5.1 || ^6.0",
"symfony/doctrine-bridge": "^3.4 || ^4.4 || ^5.1 || ^6.0",
"symfony/dom-crawler": "^3.4 || ^4.4 || ^5.1 || ^6.0",
"symfony/event-dispatcher": "^3.4 || ^4.4 || ^5.1 || ^6.0",
"symfony/expression-language": "^3.4 || ^4.4 || ^5.1 || ^6.0",
"symfony/finder": "^3.4 || ^4.4 || ^5.1 || ^6.0",
"symfony/form": "^3.4 || ^4.4 || ^5.1 || ^6.0",
"symfony/framework-bundle": "^4.4 || ^5.1 || ^6.0",
"symfony/http-client": "^4.4 || ^5.1 || ^6.0",
"symfony/intl": "^4.4 || ^5.3 || ^6.0",
"symfony/maker-bundle": "^1.24",
"symfony/mercure-bundle": "*",
"symfony/messenger": "^4.4 || ^5.1 || ^6.0",
"symfony/phpunit-bridge": "^5.4 || ^6.0",
"symfony/routing": "^3.4 || ^4.4 || ^5.1 || ^6.0",
"symfony/security-bundle": "^3.4 || ^4.4 || ^5.1 || ^6.0",
"symfony/security-core": "^4.4 || ^5.1 || ^6.0",
"symfony/twig-bundle": "^3.4 || ^4.4 || ^5.1 || ^6.0",
"symfony/validator": "^3.4 || ^4.4 || ^5.1 || ^6.0",
"symfony/web-profiler-bundle": "^4.4 || ^5.1 || ^6.0",
"symfony/yaml": "^3.4 || ^4.4 || ^5.1 || ^6.0",
"twig/twig": "^1.42.3 || ^2.12 || ^3.0",
"webonyx/graphql-php": "^14.0"
},
"suggest": {
"doctrine/mongodb-odm-bundle": "To support MongoDB. Only versions 4.0 and later are supported.",
"elasticsearch/elasticsearch": "To support Elasticsearch.",
"ocramius/package-versions": "To display the API Platform's version in the debug bar.",
"phpdocumentor/reflection-docblock": "To support extracting metadata from PHPDoc.",
"psr/cache-implementation": "To use metadata caching.",
"ramsey/uuid": "To support Ramsey's UUID identifiers.",
"symfony/cache": "To have metadata caching when using Symfony integration.",
"symfony/config": "To load XML configuration files.",
"symfony/expression-language": "To use authorization features.",
"symfony/http-client": "To use the HTTP cache invalidation system.",
"symfony/messenger": "To support messenger integration.",
"symfony/security": "To use authorization features.",
"symfony/twig-bundle": "To use the Swagger UI integration.",
"symfony/uid": "To support Symfony UUID/ULID identifiers.",
"symfony/web-profiler-bundle": "To use the data collector.",
"webonyx/graphql-php": "To support GraphQL."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "2.7.x-dev"
},
"symfony": {
"require": "^3.4 || ^4.4 || ^5.1 || ^6.0"
}
},
"autoload": {
"files": [
"src/deprecation.php"
],
"psr-4": {
"ApiPlatform\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kévin Dunglas",
"email": "kevin@dunglas.fr",
"homepage": "https://dunglas.fr"
}
],
"description": "Build a fully-featured hypermedia or GraphQL API in minutes!",
"homepage": "https://api-platform.com",
"keywords": [
"Hydra",
"JSON-LD",
"api",
"graphql",
"hal",
"jsonapi",
"openapi",
"rest",
"swagger"
],
"support": {
"issues": "https://github.com/api-platform/core/issues",
"source": "https://github.com/api-platform/core/tree/v2.7.1"
},
"funding": [
{
"url": "https://tidelift.com/funding/github/packagist/api-platform/core",
"type": "tidelift"
}
],
"time": "2022-09-29T13:55:21+00:00"
},
{
"name": "doctrine/annotations",
"version": "1.13.3",
@ -5446,6 +5615,109 @@
],
"time": "2022-09-29T19:14:22+00:00"
},
{
"name": "symfony/serializer",
"version": "v5.4.13",
"source": {
"type": "git",
"url": "https://github.com/symfony/serializer.git",
"reference": "f8c32e94c8656c17a7360d88d6d486bc8ce23b2d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/serializer/zipball/f8c32e94c8656c17a7360d88d6d486bc8ce23b2d",
"reference": "f8c32e94c8656c17a7360d88d6d486bc8ce23b2d",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1|^3",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-php80": "^1.16"
},
"conflict": {
"doctrine/annotations": "<1.12",
"phpdocumentor/reflection-docblock": "<3.2.2",
"phpdocumentor/type-resolver": "<1.4.0",
"symfony/dependency-injection": "<4.4",
"symfony/property-access": "<5.4",
"symfony/property-info": "<5.3.13",
"symfony/uid": "<5.3",
"symfony/yaml": "<4.4"
},
"require-dev": {
"doctrine/annotations": "^1.12",
"phpdocumentor/reflection-docblock": "^3.2|^4.0|^5.0",
"symfony/cache": "^4.4|^5.0|^6.0",
"symfony/config": "^4.4|^5.0|^6.0",
"symfony/dependency-injection": "^4.4|^5.0|^6.0",
"symfony/error-handler": "^4.4|^5.0|^6.0",
"symfony/filesystem": "^4.4|^5.0|^6.0",
"symfony/form": "^4.4|^5.0|^6.0",
"symfony/http-foundation": "^4.4|^5.0|^6.0",
"symfony/http-kernel": "^4.4|^5.0|^6.0",
"symfony/mime": "^4.4|^5.0|^6.0",
"symfony/property-access": "^5.4|^6.0",
"symfony/property-info": "^5.3.13|^6.0",
"symfony/uid": "^5.3|^6.0",
"symfony/validator": "^4.4|^5.0|^6.0",
"symfony/var-dumper": "^4.4|^5.0|^6.0",
"symfony/var-exporter": "^4.4|^5.0|^6.0",
"symfony/yaml": "^4.4|^5.0|^6.0"
},
"suggest": {
"psr/cache-implementation": "For using the metadata cache.",
"symfony/config": "For using the XML mapping loader.",
"symfony/mime": "For using a MIME type guesser within the DataUriNormalizer.",
"symfony/property-access": "For using the ObjectNormalizer.",
"symfony/property-info": "To deserialize relations.",
"symfony/var-exporter": "For using the metadata compiler.",
"symfony/yaml": "For using the default YAML mapping loader."
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Serializer\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/serializer/tree/v5.4.13"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-09-29T09:26:59+00:00"
},
{
"name": "symfony/service-contracts",
"version": "v2.5.2",
@ -6558,6 +6830,128 @@
}
],
"time": "2022-09-28T08:42:51+00:00"
},
{
"name": "webonyx/graphql-php",
"version": "v14.11.8",
"source": {
"type": "git",
"url": "https://github.com/webonyx/graphql-php.git",
"reference": "04a48693acd785330eefd3b0e4fa67df8dfee7c3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webonyx/graphql-php/zipball/04a48693acd785330eefd3b0e4fa67df8dfee7c3",
"reference": "04a48693acd785330eefd3b0e4fa67df8dfee7c3",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-mbstring": "*",
"php": "^7.1 || ^8"
},
"require-dev": {
"amphp/amp": "^2.3",
"doctrine/coding-standard": "^6.0",
"nyholm/psr7": "^1.2",
"phpbench/phpbench": "^1.2",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.82",
"phpstan/phpstan-phpunit": "0.12.18",
"phpstan/phpstan-strict-rules": "0.12.9",
"phpunit/phpunit": "^7.2 || ^8.5",
"psr/http-message": "^1.0",
"react/promise": "2.*",
"simpod/php-coveralls-mirror": "^3.0",
"squizlabs/php_codesniffer": "3.5.4"
},
"suggest": {
"psr/http-message": "To use standard GraphQL server",
"react/promise": "To leverage async resolving on React PHP platform"
},
"type": "library",
"autoload": {
"psr-4": {
"GraphQL\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "A PHP port of GraphQL reference implementation",
"homepage": "https://github.com/webonyx/graphql-php",
"keywords": [
"api",
"graphql"
],
"support": {
"issues": "https://github.com/webonyx/graphql-php/issues",
"source": "https://github.com/webonyx/graphql-php/tree/v14.11.8"
},
"funding": [
{
"url": "https://opencollective.com/webonyx-graphql-php",
"type": "open_collective"
}
],
"time": "2022-09-21T15:35:03+00:00"
},
{
"name": "willdurand/negotiation",
"version": "3.1.0",
"source": {
"type": "git",
"url": "https://github.com/willdurand/Negotiation.git",
"reference": "68e9ea0553ef6e2ee8db5c1d98829f111e623ec2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/willdurand/Negotiation/zipball/68e9ea0553ef6e2ee8db5c1d98829f111e623ec2",
"reference": "68e9ea0553ef6e2ee8db5c1d98829f111e623ec2",
"shasum": ""
},
"require": {
"php": ">=7.1.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^5.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"Negotiation\\": "src/Negotiation"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "William Durand",
"email": "will+git@drnd.me"
}
],
"description": "Content Negotiation tools for PHP provided as a standalone library.",
"homepage": "http://williamdurand.fr/Negotiation/",
"keywords": [
"accept",
"content",
"format",
"header",
"negotiation"
],
"support": {
"issues": "https://github.com/willdurand/Negotiation/issues",
"source": "https://github.com/willdurand/Negotiation/tree/3.1.0"
},
"time": "2022-01-30T20:08:53+00:00"
}
],
"packages-dev": [

View File

@ -10,4 +10,5 @@ return [
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
];

View File

@ -0,0 +1,7 @@
api_platform:
mapping:
paths: ['%kernel.project_dir%/src/Entity']
patch_formats:
json: ['application/merge-patch+json']
swagger:
versions: [3]

View File

@ -1,5 +1,6 @@
twig:
default_path: '%kernel.project_dir%/templates'
form_themes: ['bootstrap_5_layout.html.twig']
when@test:
twig:

View File

@ -0,0 +1,4 @@
api_platform:
resource: .
type: api_platform
prefix: /api

View File

@ -5,6 +5,7 @@
"@hotwired/stimulus": "^3.0.0",
"@symfony/stimulus-bridge": "^3.2.0",
"@symfony/webpack-encore": "^4.0.0",
"bootstrap": "^5.2.1",
"core-js": "^3.23.0",
"regenerator-runtime": "^0.13.9",
"webpack": "^5.74.0",
@ -21,6 +22,11 @@
},
"dependencies": {
"sass": "^1.55.0",
"sass-loader": "^13.0.2"
"sass-loader": "^13.0.2",
"vue": "^3.2.40",
"vue-cli": "^2.9.6",
"vue-loader": "^17.0.0",
"vue-resource": "^1.5.3",
"vue-template-compiler": "^2.7.10"
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class VueController extends AbstractController
{
/**
* @Route("/vue", name="app_vue")
*/
public function index(): Response
{
return $this->render('vue/index.html.twig', [
'controller_name' => 'VueController',
'data' => [
'user' => [
'username' => 'Charles',
'age' => 31
]
]
]);
}
}

View File

@ -1,4 +1,18 @@
{
"api-platform/core": {
"version": "2.7",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.5",
"ref": "05b57782a78c21a664a42055dc11cf1954ca36bb"
},
"files": [
"config/packages/api_platform.yaml",
"config/routes/api_platform.yaml",
"src/Entity/.gitignore"
]
},
"doctrine/annotations": {
"version": "1.13",
"recipe": {

View File

@ -7,10 +7,12 @@
{# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #}
{% block stylesheets %}
{{ encore_entry_link_tags('app') }}
{{ encore_entry_link_tags('vue') }}
{% endblock %}
{% block javascripts %}
{{ encore_entry_script_tags('app') }}
{{ encore_entry_script_tags('vue') }}
{% endblock %}
</head>
<body>

View File

@ -0,0 +1,13 @@
{% extends 'base.html.twig' %}
{% block title %}{{'My VueJS template'}}{% endblock %}
{% block body %}
<div class="container">
<h1>{{'My VueJS template'}}</h1>
<div id="app" data-app="{{ data | json_encode() | escape('html_attr') }}"></div>
</div>{{ dump() }}
{% endblock %}

View File

@ -22,8 +22,11 @@ Encore
*/
.addEntry('app', './assets/app.js')
// start VueJS application
.addEntry('vue', './assets/vue/index.js')
// enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)
.enableStimulusBridge('./assets/controllers.json')
.enableStimulusBridge('./assets/stimulus/controllers.json')
// When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
.splitEntryChunks()
@ -57,7 +60,10 @@ Encore
})
// enables Sass/SCSS support
//.enableSassLoader()
.enableSassLoader()
// enable VueJS support
.enableVueLoader()
// uncomment if you use TypeScript
//.enableTypeScriptLoader()

File diff suppressed because it is too large Load Diff