Add Hono app for the project.
This commit is contained in:
parent
dda9cf2fe2
commit
91c2d7b9fd
3
app/.editorconfig
Normal file
3
app/.editorconfig
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[*.{js,jsx,ts,tsx}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
8
app/.gitignore
vendored
8
app/.gitignore
vendored
@ -1,7 +1 @@
|
|||||||
/.phpcs-cache
|
node_modules
|
||||||
/.psalm-cache
|
|
||||||
/.phpunit.cache
|
|
||||||
/clover.xml
|
|
||||||
/coveralls-upload.json
|
|
||||||
/phpunit.xml
|
|
||||||
/vendor/
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Due to the fact that we are disabling plugins when installing/updating/downgrading composer dependencies
|
|
||||||
# we have to manually enable the coding standard here.
|
|
||||||
composer enable-codestandard
|
|
@ -1 +0,0 @@
|
|||||||
Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC. (https://getlaminas.org/)
|
|
@ -1,26 +0,0 @@
|
|||||||
Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
- Redistributions of source code must retain the above copyright notice, this
|
|
||||||
list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
- Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
- Neither the name of Laminas Foundation nor the names of its contributors may
|
|
||||||
be used to endorse or promote products derived from this software without
|
|
||||||
specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
||||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -1,3 +1,11 @@
|
|||||||
# Slovocast
|
To install dependencies:
|
||||||
|
```sh
|
||||||
|
bun install
|
||||||
|
```
|
||||||
|
|
||||||
A simple Podcast hosting application built on top of Laminas Mezzio framework.
|
To run:
|
||||||
|
```sh
|
||||||
|
bun run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
open http://localhost:3000
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
chdir(__DIR__ . '/../');
|
|
||||||
|
|
||||||
require 'vendor/autoload.php';
|
|
||||||
|
|
||||||
$config = include 'config/config.php';
|
|
||||||
|
|
||||||
if (! isset($config['config_cache_path'])) {
|
|
||||||
echo "No configuration cache path found" . PHP_EOL;
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! file_exists($config['config_cache_path'])) {
|
|
||||||
printf(
|
|
||||||
"Configured config cache file '%s' not found%s",
|
|
||||||
$config['config_cache_path'],
|
|
||||||
PHP_EOL
|
|
||||||
);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (false === unlink($config['config_cache_path'])) {
|
|
||||||
printf(
|
|
||||||
"Error removing config cache file '%s'%s",
|
|
||||||
$config['config_cache_path'],
|
|
||||||
PHP_EOL
|
|
||||||
);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf(
|
|
||||||
"Removed configured config cache file '%s'%s",
|
|
||||||
$config['config_cache_path'],
|
|
||||||
PHP_EOL
|
|
||||||
);
|
|
||||||
exit(0);
|
|
BIN
app/bun.lockb
Executable file
BIN
app/bun.lockb
Executable file
Binary file not shown.
@ -1,115 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "mezzio/mezzio-skeleton",
|
|
||||||
"description": "Laminas mezzio skeleton. Begin developing PSR-15 middleware applications in seconds!",
|
|
||||||
"type": "project",
|
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"keywords": [
|
|
||||||
"laminas",
|
|
||||||
"mezzio",
|
|
||||||
"skeleton",
|
|
||||||
"middleware",
|
|
||||||
"psr",
|
|
||||||
"psr-7",
|
|
||||||
"psr-11",
|
|
||||||
"psr-15"
|
|
||||||
],
|
|
||||||
"homepage": "https://mezzio.dev",
|
|
||||||
"support": {
|
|
||||||
"docs": "https://docs.mezzio.dev/mezzio/",
|
|
||||||
"issues": "https://github.com/mezzio/mezzio-skeleton/issues",
|
|
||||||
"source": "https://github.com/mezzio/mezzio-skeleton",
|
|
||||||
"rss": "https://github.com/mezzio/mezzio-skeleton/releases.atom",
|
|
||||||
"chat": "https://laminas.dev/chat",
|
|
||||||
"forum": "https://discourse.laminas.dev"
|
|
||||||
},
|
|
||||||
"config": {
|
|
||||||
"sort-packages": true,
|
|
||||||
"allow-plugins": {
|
|
||||||
"dealerdirect/phpcodesniffer-composer-installer": true,
|
|
||||||
"composer/package-versions-deprecated": true,
|
|
||||||
"laminas/laminas-component-installer": true
|
|
||||||
},
|
|
||||||
"platform": {
|
|
||||||
"php": "8.1.99"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"extra": {
|
|
||||||
"laminas": {
|
|
||||||
"component-whitelist": [
|
|
||||||
"mezzio/mezzio",
|
|
||||||
"mezzio/mezzio-helpers",
|
|
||||||
"mezzio/mezzio-router",
|
|
||||||
"laminas/laminas-httphandlerrunner",
|
|
||||||
"mezzio/mezzio-fastroute",
|
|
||||||
"mezzio/mezzio-platesrenderer"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
|
|
||||||
"ext-pdo": "*",
|
|
||||||
"composer/package-versions-deprecated": "^1.10.99",
|
|
||||||
"elie29/zend-phpdi-config": "^9.0",
|
|
||||||
"laminas/laminas-component-installer": "^2.6 || ^3.0",
|
|
||||||
"laminas/laminas-config-aggregator": "^1.6",
|
|
||||||
"laminas/laminas-diactoros": "^3.0.0",
|
|
||||||
"laminas/laminas-stdlib": "^3.6",
|
|
||||||
"mezzio/mezzio": "^3.7",
|
|
||||||
"mezzio/mezzio-authentication-session": "^1.9",
|
|
||||||
"mezzio/mezzio-fastroute": "^3.11.0",
|
|
||||||
"mezzio/mezzio-helpers": "^5.7",
|
|
||||||
"mezzio/mezzio-platesrenderer": "^2.10"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"filp/whoops": "^2.15.4",
|
|
||||||
"laminas/laminas-coding-standard": "~2.5.0",
|
|
||||||
"laminas/laminas-development-mode": "^3.12.0",
|
|
||||||
"mezzio/mezzio-tooling": "^2.9",
|
|
||||||
"phpunit/phpunit": "^10.5.5",
|
|
||||||
"psalm/plugin-phpunit": "^0.18.4",
|
|
||||||
"roave/security-advisories": "dev-master",
|
|
||||||
"vimeo/psalm": "^5.18"
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"App\\": "src/App/src/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload-dev": {
|
|
||||||
"psr-4": {
|
|
||||||
"AppTest\\": "test/AppTest/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"post-create-project-cmd": [
|
|
||||||
"@development-enable"
|
|
||||||
],
|
|
||||||
"post-install-cmd": "@clear-config-cache",
|
|
||||||
"post-update-cmd": "@clear-config-cache",
|
|
||||||
"development-disable": "laminas-development-mode disable",
|
|
||||||
"development-enable": "laminas-development-mode enable",
|
|
||||||
"development-status": "laminas-development-mode status",
|
|
||||||
"mezzio": "laminas --ansi",
|
|
||||||
"check": [
|
|
||||||
"@cs-check",
|
|
||||||
"@test"
|
|
||||||
],
|
|
||||||
"clear-config-cache": "php bin/clear-config-cache.php",
|
|
||||||
"enable-codestandard": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run",
|
|
||||||
"cs-check": "phpcs",
|
|
||||||
"cs-fix": "phpcbf",
|
|
||||||
"serve": [
|
|
||||||
"Composer\\Config::disableProcessTimeout",
|
|
||||||
"php -S 0.0.0.0:8080 -t public/"
|
|
||||||
],
|
|
||||||
"static-analysis": "psalm --stats",
|
|
||||||
"static-analysis-update-baseline": "psalm --stats --update-baseline",
|
|
||||||
"test": "phpunit --colors=always",
|
|
||||||
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml"
|
|
||||||
},
|
|
||||||
"scripts-descriptions": {
|
|
||||||
"clear-config-cache": "Clears merged config cache. Required for config changes to be applied.",
|
|
||||||
"static-analysis": "Run static analysis tool Psalm.",
|
|
||||||
"static-analysis-update-baseline": "Run static analysis tool Psalm and update baseline."
|
|
||||||
}
|
|
||||||
}
|
|
7427
app/composer.lock
generated
7427
app/composer.lock
generated
File diff suppressed because it is too large
Load Diff
1
app/config/.gitignore
vendored
1
app/config/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
development.config.php
|
|
2
app/config/autoload/.gitignore
vendored
2
app/config/autoload/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
local.php
|
|
||||||
*.local.php
|
|
@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Mezzio\Authentication\AuthenticationInterface;
|
|
||||||
use Mezzio\Authentication\Session\PhpSession;
|
|
||||||
use Mezzio\Authentication\UserRepository\PdoDatabase;
|
|
||||||
use Mezzio\Authentication\UserRepositoryInterface;
|
|
||||||
|
|
||||||
return [
|
|
||||||
// Provides application-wide services.
|
|
||||||
// We recommend using fully-qualified class names whenever possible as
|
|
||||||
// service names.
|
|
||||||
'dependencies' => [
|
|
||||||
// Use 'aliases' to alias a service name to another service. The
|
|
||||||
// key is the alias name, the value is the service to which it points.
|
|
||||||
'aliases' => [
|
|
||||||
AuthenticationInterface::class => PhpSession::class,
|
|
||||||
UserRepositoryInterface::class => PdoDatabase::class,
|
|
||||||
],
|
|
||||||
// Use 'invokables' for constructor-less services, or services that do
|
|
||||||
// not require arguments to the constructor. Map a service name to the
|
|
||||||
// class name.
|
|
||||||
'invokables' => [
|
|
||||||
// Fully\Qualified\InterfaceName::class => Fully\Qualified\ClassName::class,
|
|
||||||
],
|
|
||||||
// Use 'factories' for services provided by callbacks/factory classes.
|
|
||||||
'factories' => [
|
|
||||||
// Fully\Qualified\ClassName::class => Fully\Qualified\FactoryName::class,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
// phpcs:disable PSR12.Files.FileHeader.IncorrectOrder
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Development-only configuration.
|
|
||||||
*
|
|
||||||
* Put settings you want enabled when under development mode in this file, and
|
|
||||||
* check it into your repository.
|
|
||||||
*
|
|
||||||
* Developers on your team will then automatically enable them by calling on
|
|
||||||
* `composer development-enable`.
|
|
||||||
*/
|
|
||||||
|
|
||||||
use Mezzio\Container;
|
|
||||||
use Mezzio\Middleware\ErrorResponseGenerator;
|
|
||||||
|
|
||||||
return [
|
|
||||||
'dependencies' => [
|
|
||||||
'factories' => [
|
|
||||||
ErrorResponseGenerator::class => Container\WhoopsErrorResponseGeneratorFactory::class,
|
|
||||||
'Mezzio\Whoops' => Container\WhoopsFactory::class,
|
|
||||||
'Mezzio\WhoopsPageHandler' => Container\WhoopsPageHandlerFactory::class,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'whoops' => [
|
|
||||||
'json_exceptions' => [
|
|
||||||
'display' => true,
|
|
||||||
'show_trace' => true,
|
|
||||||
'ajax_only' => true,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
@ -1,13 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Local configuration.
|
|
||||||
*
|
|
||||||
* Copy this file to `local.php` and change its settings as required.
|
|
||||||
* `local.php` is ignored by git and safe to use for local and sensitive data like usernames and passwords.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
return [
|
|
||||||
];
|
|
@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This file generated by Mezzio\Tooling\Factory\ConfigInjector.
|
|
||||||
*
|
|
||||||
* Modifications should be kept at a minimum, and restricted to adding or
|
|
||||||
* removing factory definitions; other dependency types may be overwritten
|
|
||||||
* when regenerating this file via mezzio-tooling commands.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
return [
|
|
||||||
'dependencies' => [
|
|
||||||
'factories' => [
|
|
||||||
App\Login\LoginHandler::class => App\Login\LoginHandlerFactory::class,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
@ -1,27 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Laminas\ConfigAggregator\ConfigAggregator;
|
|
||||||
|
|
||||||
return [
|
|
||||||
// Toggle the configuration cache. Set this to boolean false, or remove the
|
|
||||||
// directive, to disable configuration caching. Toggling development mode
|
|
||||||
// will also disable it by default; clear the configuration cache using
|
|
||||||
// `composer clear-config-cache`.
|
|
||||||
ConfigAggregator::ENABLE_CACHE => true,
|
|
||||||
|
|
||||||
// Enable debugging; typically used to provide debugging information within templates.
|
|
||||||
'debug' => false,
|
|
||||||
'mezzio' => [
|
|
||||||
// Provide templates for the error handling middleware to use when
|
|
||||||
// generating responses.
|
|
||||||
'error_handler' => [
|
|
||||||
'template_404' => 'error::404',
|
|
||||||
'template_error' => 'error::error',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'authentication' => [
|
|
||||||
'redirect' => '/login',
|
|
||||||
],
|
|
||||||
];
|
|
@ -1,54 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Laminas\ConfigAggregator\ArrayProvider;
|
|
||||||
use Laminas\ConfigAggregator\ConfigAggregator;
|
|
||||||
use Laminas\ConfigAggregator\PhpFileProvider;
|
|
||||||
use Mezzio\Helper\ConfigProvider;
|
|
||||||
|
|
||||||
// To enable or disable caching, set the `ConfigAggregator::ENABLE_CACHE` boolean in
|
|
||||||
// `config/autoload/local.php`.
|
|
||||||
$cacheConfig = [
|
|
||||||
'config_cache_path' => 'data/cache/config-cache.php',
|
|
||||||
];
|
|
||||||
|
|
||||||
$aggregator = new ConfigAggregator([
|
|
||||||
\Mezzio\Authentication\Session\ConfigProvider::class,
|
|
||||||
\Mezzio\Authentication\ConfigProvider::class,
|
|
||||||
\Mezzio\Session\ConfigProvider::class,
|
|
||||||
\Mezzio\Tooling\ConfigProvider::class,
|
|
||||||
\Mezzio\Plates\ConfigProvider::class,
|
|
||||||
\Mezzio\Helper\ConfigProvider::class,
|
|
||||||
\Mezzio\Router\FastRouteRouter\ConfigProvider::class,
|
|
||||||
\Laminas\HttpHandlerRunner\ConfigProvider::class,
|
|
||||||
// Include cache configuration
|
|
||||||
new ArrayProvider($cacheConfig),
|
|
||||||
ConfigProvider::class,
|
|
||||||
\Mezzio\ConfigProvider::class,
|
|
||||||
\Mezzio\Router\ConfigProvider::class,
|
|
||||||
\Laminas\Diactoros\ConfigProvider::class,
|
|
||||||
|
|
||||||
// Swoole config to overwrite some services (if installed)
|
|
||||||
class_exists(\Mezzio\Swoole\ConfigProvider::class)
|
|
||||||
? \Mezzio\Swoole\ConfigProvider::class
|
|
||||||
: function (): array {
|
|
||||||
return [];
|
|
||||||
},
|
|
||||||
|
|
||||||
// Default App module config
|
|
||||||
App\ConfigProvider::class,
|
|
||||||
|
|
||||||
// Load application config in a pre-defined order in such a way that local settings
|
|
||||||
// overwrite global settings. (Loaded as first to last):
|
|
||||||
// - `global.php`
|
|
||||||
// - `*.global.php`
|
|
||||||
// - `local.php`
|
|
||||||
// - `*.local.php`
|
|
||||||
new PhpFileProvider(realpath(__DIR__) . '/autoload/{{,*.}global,{,*.}local}.php'),
|
|
||||||
|
|
||||||
// Load development config if it exists
|
|
||||||
new PhpFileProvider(realpath(__DIR__) . '/development.config.php'),
|
|
||||||
], $cacheConfig['config_cache_path']);
|
|
||||||
|
|
||||||
return $aggregator->getMergedConfig();
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Elie\PHPDI\Config\Config;
|
|
||||||
use Elie\PHPDI\Config\ContainerFactory;
|
|
||||||
use Psr\Container\ContainerInterface;
|
|
||||||
|
|
||||||
// Protect variables from global scope
|
|
||||||
return (static function (): ContainerInterface {
|
|
||||||
$config = require __DIR__ . '/config.php';
|
|
||||||
$factory = new ContainerFactory();
|
|
||||||
|
|
||||||
return $factory(new Config($config));
|
|
||||||
})();
|
|
@ -1,31 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* File required to allow enablement of development mode.
|
|
||||||
*
|
|
||||||
* For use with the laminas-development-mode tool.
|
|
||||||
*
|
|
||||||
* Usage:
|
|
||||||
* $ composer development-disable
|
|
||||||
* $ composer development-enable
|
|
||||||
* $ composer development-status
|
|
||||||
*
|
|
||||||
* DO NOT MODIFY THIS FILE.
|
|
||||||
*
|
|
||||||
* Provide your own development-mode settings by editing the file
|
|
||||||
* `config/autoload/development.local.php.dist`.
|
|
||||||
*
|
|
||||||
* Because this file is aggregated last, it simply ensures:
|
|
||||||
*
|
|
||||||
* - The `debug` flag is _enabled_.
|
|
||||||
* - Configuration caching is _disabled_.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Laminas\ConfigAggregator\ConfigAggregator;
|
|
||||||
|
|
||||||
return [
|
|
||||||
'debug' => true,
|
|
||||||
ConfigAggregator::ENABLE_CACHE => false,
|
|
||||||
];
|
|
@ -1,77 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Laminas\Stratigility\Middleware\ErrorHandler;
|
|
||||||
use Mezzio\Application;
|
|
||||||
use Mezzio\Handler\NotFoundHandler;
|
|
||||||
use Mezzio\Helper\ServerUrlMiddleware;
|
|
||||||
use Mezzio\Helper\UrlHelperMiddleware;
|
|
||||||
use Mezzio\MiddlewareFactory;
|
|
||||||
use Mezzio\Router\Middleware\DispatchMiddleware;
|
|
||||||
use Mezzio\Router\Middleware\ImplicitHeadMiddleware;
|
|
||||||
use Mezzio\Router\Middleware\ImplicitOptionsMiddleware;
|
|
||||||
use Mezzio\Router\Middleware\MethodNotAllowedMiddleware;
|
|
||||||
use Mezzio\Router\Middleware\RouteMiddleware;
|
|
||||||
use Psr\Container\ContainerInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setup middleware pipeline:
|
|
||||||
*/
|
|
||||||
|
|
||||||
return function (Application $app, MiddlewareFactory $factory, ContainerInterface $container): void {
|
|
||||||
// The error handler should be the first (most outer) middleware to catch
|
|
||||||
// all Exceptions.
|
|
||||||
$app->pipe(ErrorHandler::class);
|
|
||||||
$app->pipe(ServerUrlMiddleware::class);
|
|
||||||
|
|
||||||
// Pipe more middleware here that you want to execute on every request:
|
|
||||||
// - bootstrapping
|
|
||||||
// - pre-conditions
|
|
||||||
// - modifications to outgoing responses
|
|
||||||
//
|
|
||||||
// Piped Middleware may be either callables or service names. Middleware may
|
|
||||||
// also be passed as an array; each item in the array must resolve to
|
|
||||||
// middleware eventually (i.e., callable or service name).
|
|
||||||
//
|
|
||||||
// Middleware can be attached to specific paths, allowing you to mix and match
|
|
||||||
// applications under a common domain. The handlers in each middleware
|
|
||||||
// attached this way will see a URI with the matched path segment removed.
|
|
||||||
//
|
|
||||||
// i.e., path of "/api/member/profile" only passes "/member/profile" to $apiMiddleware
|
|
||||||
// - $app->pipe('/api', $apiMiddleware);
|
|
||||||
// - $app->pipe('/docs', $apiDocMiddleware);
|
|
||||||
// - $app->pipe('/files', $filesMiddleware);
|
|
||||||
|
|
||||||
// Register the routing middleware in the middleware pipeline.
|
|
||||||
// This middleware registers the Mezzio\Router\RouteResult request attribute.
|
|
||||||
$app->pipe(RouteMiddleware::class);
|
|
||||||
|
|
||||||
// The following handle routing failures for common conditions:
|
|
||||||
// - HEAD request but no routes answer that method
|
|
||||||
// - OPTIONS request but no routes answer that method
|
|
||||||
// - method not allowed
|
|
||||||
// Order here matters; the MethodNotAllowedMiddleware should be placed
|
|
||||||
// after the Implicit*Middleware.
|
|
||||||
$app->pipe(ImplicitHeadMiddleware::class);
|
|
||||||
$app->pipe(ImplicitOptionsMiddleware::class);
|
|
||||||
$app->pipe(MethodNotAllowedMiddleware::class);
|
|
||||||
|
|
||||||
// Seed the UrlHelper with the routing results:
|
|
||||||
$app->pipe(UrlHelperMiddleware::class);
|
|
||||||
|
|
||||||
// Add more middleware here that needs to introspect the routing results; this
|
|
||||||
// might include:
|
|
||||||
//
|
|
||||||
// - route-based authentication
|
|
||||||
// - route-based validation
|
|
||||||
// - etc.
|
|
||||||
|
|
||||||
// Register the dispatch middleware in the middleware pipeline
|
|
||||||
$app->pipe(DispatchMiddleware::class);
|
|
||||||
|
|
||||||
// At this point, if no Response is returned by any middleware, the
|
|
||||||
// NotFoundHandler kicks in; alternately, you can provide other fallback
|
|
||||||
// middleware to execute.
|
|
||||||
$app->pipe(NotFoundHandler::class);
|
|
||||||
};
|
|
@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Mezzio\Application;
|
|
||||||
use Mezzio\MiddlewareFactory;
|
|
||||||
use Psr\Container\ContainerInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FastRoute route configuration
|
|
||||||
*
|
|
||||||
* @see https://github.com/nikic/FastRoute
|
|
||||||
*
|
|
||||||
* Setup routes with a single request method:
|
|
||||||
*
|
|
||||||
* $app->get('/', App\Handler\HomePageHandler::class, 'home');
|
|
||||||
* $app->post('/album', App\Handler\AlbumCreateHandler::class, 'album.create');
|
|
||||||
* $app->put('/album/{id:\d+}', App\Handler\AlbumUpdateHandler::class, 'album.put');
|
|
||||||
* $app->patch('/album/{id:\d+}', App\Handler\AlbumUpdateHandler::class, 'album.patch');
|
|
||||||
* $app->delete('/album/{id:\d+}', App\Handler\AlbumDeleteHandler::class, 'album.delete');
|
|
||||||
*
|
|
||||||
* Or with multiple request methods:
|
|
||||||
*
|
|
||||||
* $app->route('/contact', App\Handler\ContactHandler::class, ['GET', 'POST', ...], 'contact');
|
|
||||||
*
|
|
||||||
* Or handling all request methods:
|
|
||||||
*
|
|
||||||
* $app->route('/contact', App\Handler\ContactHandler::class)->setName('contact');
|
|
||||||
*
|
|
||||||
* or:
|
|
||||||
*
|
|
||||||
* $app->route(
|
|
||||||
* '/contact',
|
|
||||||
* App\Handler\ContactHandler::class,
|
|
||||||
* Mezzio\Router\Route::HTTP_METHOD_ANY,
|
|
||||||
* 'contact'
|
|
||||||
* );
|
|
||||||
*/
|
|
||||||
|
|
||||||
return static function (Application $app, MiddlewareFactory $factory, ContainerInterface $container): void {
|
|
||||||
$app->get('/', App\Handler\HomePageHandler::class, 'home');
|
|
||||||
$app->get('/api/ping', App\Handler\PingHandler::class, 'api.ping');
|
|
||||||
};
|
|
4
app/data/.gitignore
vendored
4
app/data/.gitignore
vendored
@ -1,4 +0,0 @@
|
|||||||
*
|
|
||||||
!cache
|
|
||||||
!cache/.gitkeep
|
|
||||||
!.gitignore
|
|
0
app/data/cache/.gitkeep
vendored
0
app/data/cache/.gitkeep
vendored
11
app/package.json
Normal file
11
app/package.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"scripts": {
|
||||||
|
"dev": "bun run --hot src/index.ts"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"hono": "^4.0.8"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/bun": "latest"
|
||||||
|
}
|
||||||
|
}
|
@ -1,32 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
|
|
||||||
|
|
||||||
<arg name="basepath" value="."/>
|
|
||||||
<arg name="cache" value=".phpcs-cache"/>
|
|
||||||
<arg name="colors"/>
|
|
||||||
<arg name="extensions" value="php"/>
|
|
||||||
<arg name="parallel" value="80"/>
|
|
||||||
|
|
||||||
<!-- Show progress -->
|
|
||||||
<arg value="p"/>
|
|
||||||
|
|
||||||
<!-- Paths to check -->
|
|
||||||
<file>config</file>
|
|
||||||
<file>src</file>
|
|
||||||
<file>test</file>
|
|
||||||
<exclude-pattern>config/config.php</exclude-pattern>
|
|
||||||
<exclude-pattern>config/routes.php</exclude-pattern>
|
|
||||||
|
|
||||||
<!-- Include all rules from the Laminas Coding Standard -->
|
|
||||||
<rule ref="LaminasCodingStandard"/>
|
|
||||||
|
|
||||||
<rule ref="Squiz.Classes.ClassFileName.NoMatch">
|
|
||||||
<exclude-pattern>src/ConfigProvider.*.php</exclude-pattern>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<rule ref="PSR12.Files.FileHeader.IncorrectOrder">
|
|
||||||
<exclude-pattern>config/pipeline.php</exclude-pattern>
|
|
||||||
<exclude-pattern>src/MezzioInstaller/Resources/config/routes-*.php</exclude-pattern>
|
|
||||||
</rule>
|
|
||||||
</ruleset>
|
|
@ -1,26 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<phpunit
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
|
||||||
bootstrap="vendor/autoload.php"
|
|
||||||
cacheDirectory=".phpunit.cache"
|
|
||||||
displayDetailsOnIncompleteTests="true"
|
|
||||||
displayDetailsOnSkippedTests="true"
|
|
||||||
displayDetailsOnTestsThatTriggerDeprecations="true"
|
|
||||||
displayDetailsOnTestsThatTriggerErrors="true"
|
|
||||||
displayDetailsOnTestsThatTriggerNotices="true"
|
|
||||||
displayDetailsOnTestsThatTriggerWarnings="true"
|
|
||||||
colors="true"
|
|
||||||
>
|
|
||||||
<testsuites>
|
|
||||||
<testsuite name="default">
|
|
||||||
<directory>./test</directory>
|
|
||||||
</testsuite>
|
|
||||||
</testsuites>
|
|
||||||
|
|
||||||
<source>
|
|
||||||
<include>
|
|
||||||
<directory suffix=".php">src</directory>
|
|
||||||
</include>
|
|
||||||
</source>
|
|
||||||
</phpunit>
|
|
@ -1,295 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<files psalm-version="5.18.0@b113f3ed0259fd6e212d87c3df80eec95a6abf19">
|
|
||||||
<file src="src/MezzioInstaller/OptionalPackages.php">
|
|
||||||
<ArgumentTypeCoercion>
|
|
||||||
<code><![CDATA[$this->stabilityFlags]]></code>
|
|
||||||
</ArgumentTypeCoercion>
|
|
||||||
<MixedArgument>
|
|
||||||
<code>$answer</code>
|
|
||||||
<code>$constraint</code>
|
|
||||||
<code>$filename</code>
|
|
||||||
<code>$filename</code>
|
|
||||||
<code>$package</code>
|
|
||||||
<code>$target</code>
|
|
||||||
<code><![CDATA[$this->composerDefinition['autoload']]]></code>
|
|
||||||
<code><![CDATA[$this->composerDefinition['autoload-dev']]]></code>
|
|
||||||
<code>$word</code>
|
|
||||||
</MixedArgument>
|
|
||||||
<MixedArgumentTypeCoercion>
|
|
||||||
<code>$package</code>
|
|
||||||
</MixedArgumentTypeCoercion>
|
|
||||||
<MixedArrayAccess>
|
|
||||||
<code><![CDATA[$this->composerDefinition['autoload']['psr-4']]]></code>
|
|
||||||
<code><![CDATA[$this->composerDefinition['autoload']['psr-4']['MezzioInstaller\\']]]></code>
|
|
||||||
<code><![CDATA[$this->composerDefinition['autoload-dev']['psr-4']]]></code>
|
|
||||||
<code><![CDATA[$this->composerDefinition['autoload-dev']['psr-4']['MezzioInstallerTest\\']]]></code>
|
|
||||||
<code><![CDATA[$this->composerDefinition['scripts']['pre-install-cmd']]]></code>
|
|
||||||
<code><![CDATA[$this->composerDefinition['scripts']['pre-update-cmd']]]></code>
|
|
||||||
</MixedArrayAccess>
|
|
||||||
<MixedArrayAssignment>
|
|
||||||
<code><![CDATA[$this->composerDefinition['autoload']['psr-4']]]></code>
|
|
||||||
<code><![CDATA[$this->composerDefinition['autoload']['psr-4']['App\\']]]></code>
|
|
||||||
<code><![CDATA[$this->composerDefinition['require'][$packageName]]]></code>
|
|
||||||
<code><![CDATA[$this->composerDefinition['require-dev'][$packageName]]]></code>
|
|
||||||
<code><![CDATA[$this->composerDefinition['scripts']['cs-check']]]></code>
|
|
||||||
<code><![CDATA[$this->composerDefinition['scripts']['cs-fix']]]></code>
|
|
||||||
</MixedArrayAssignment>
|
|
||||||
<MixedAssignment>
|
|
||||||
<code>$answer</code>
|
|
||||||
<code>$answer</code>
|
|
||||||
<code>$constraint</code>
|
|
||||||
<code>$fileInfo</code>
|
|
||||||
<code>$filename</code>
|
|
||||||
<code>$package</code>
|
|
||||||
<code>$target</code>
|
|
||||||
<code><![CDATA[$this->composerDefinition]]></code>
|
|
||||||
</MixedAssignment>
|
|
||||||
<MixedMethodCall>
|
|
||||||
<code>isDir</code>
|
|
||||||
</MixedMethodCall>
|
|
||||||
<MixedPropertyTypeCoercion>
|
|
||||||
<code><![CDATA[$this->composerDefinition]]></code>
|
|
||||||
<code><![CDATA[$this->composerDefinition]]></code>
|
|
||||||
<code><![CDATA[$this->composerDefinition]]></code>
|
|
||||||
</MixedPropertyTypeCoercion>
|
|
||||||
<NoValue>
|
|
||||||
<code><![CDATA[$this->installType]]></code>
|
|
||||||
</NoValue>
|
|
||||||
<PossiblyInvalidArgument>
|
|
||||||
<code>$resource</code>
|
|
||||||
</PossiblyInvalidArgument>
|
|
||||||
<PossiblyInvalidIterator>
|
|
||||||
<code><![CDATA[$question['options'][$answer][$this->installType]]]></code>
|
|
||||||
</PossiblyInvalidIterator>
|
|
||||||
<PossiblyNullArgument>
|
|
||||||
<code>$content</code>
|
|
||||||
</PossiblyNullArgument>
|
|
||||||
<PossiblyUnusedMethod>
|
|
||||||
<code>install</code>
|
|
||||||
</PossiblyUnusedMethod>
|
|
||||||
<PropertyTypeCoercion>
|
|
||||||
<code><![CDATA[require __DIR__ . '/config.php']]></code>
|
|
||||||
</PropertyTypeCoercion>
|
|
||||||
</file>
|
|
||||||
<file src="test/AppTest/Handler/PingHandlerTest.php">
|
|
||||||
<MixedArgument>
|
|
||||||
<code>$json</code>
|
|
||||||
</MixedArgument>
|
|
||||||
<MixedAssignment>
|
|
||||||
<code>$json</code>
|
|
||||||
</MixedAssignment>
|
|
||||||
<MixedPropertyFetch>
|
|
||||||
<code><![CDATA[$json->ack]]></code>
|
|
||||||
</MixedPropertyFetch>
|
|
||||||
</file>
|
|
||||||
<file src="test/MezzioInstallerTest/AddPackageTest.php">
|
|
||||||
<MixedArgument>
|
|
||||||
<code>$stabilityFlags</code>
|
|
||||||
</MixedArgument>
|
|
||||||
<MixedAssignment>
|
|
||||||
<code>$stabilityFlags</code>
|
|
||||||
</MixedAssignment>
|
|
||||||
<MixedInferredReturnType>
|
|
||||||
<code>array</code>
|
|
||||||
</MixedInferredReturnType>
|
|
||||||
</file>
|
|
||||||
<file src="test/MezzioInstallerTest/ContainersTest.php">
|
|
||||||
<MixedArgument>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['router']]]></code>
|
|
||||||
</MixedArgument>
|
|
||||||
<MixedArrayAccess>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['router']]]></code>
|
|
||||||
</MixedArrayAccess>
|
|
||||||
</file>
|
|
||||||
<file src="test/MezzioInstallerTest/ErrorHandlerTest.php">
|
|
||||||
<MixedArgument>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['error-handler']]]></code>
|
|
||||||
</MixedArgument>
|
|
||||||
<MixedArrayAccess>
|
|
||||||
<code><![CDATA[$config['dependencies']]]></code>
|
|
||||||
<code><![CDATA[$config['dependencies']['factories']]]></code>
|
|
||||||
<code><![CDATA[$config['dependencies']['factories'][ErrorResponseGenerator::class]]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['error-handler']]]></code>
|
|
||||||
</MixedArrayAccess>
|
|
||||||
<MixedAssignment>
|
|
||||||
<code>$config</code>
|
|
||||||
</MixedAssignment>
|
|
||||||
<MixedInferredReturnType>
|
|
||||||
<code>array</code>
|
|
||||||
</MixedInferredReturnType>
|
|
||||||
</file>
|
|
||||||
<file src="test/MezzioInstallerTest/HomePageResponseTest.php">
|
|
||||||
<MixedArgument>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['router']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['router']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['template-engine']]]></code>
|
|
||||||
</MixedArgument>
|
|
||||||
<MixedArrayAccess>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['router']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['router']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['template-engine']]]></code>
|
|
||||||
</MixedArrayAccess>
|
|
||||||
<MoreSpecificReturnType>
|
|
||||||
<code><![CDATA[Generator<string, array{
|
|
||||||
* 0: OptionalPackages::INSTALL_*,
|
|
||||||
* 1: int,
|
|
||||||
* 2: int,
|
|
||||||
* 3: class-string<TemplateRendererInterface>,
|
|
||||||
* 4: string,
|
|
||||||
* 5: string
|
|
||||||
* }>]]></code>
|
|
||||||
<code><![CDATA[Generator<string, array{
|
|
||||||
* 0: OptionalPackages::INSTALL_*,
|
|
||||||
* 1: int,
|
|
||||||
* 2: string,
|
|
||||||
* 3: string,
|
|
||||||
* 4: int,
|
|
||||||
* 5: class-string<RouterInterface>,
|
|
||||||
* 6: string,
|
|
||||||
* 7: string
|
|
||||||
* }>]]></code>
|
|
||||||
</MoreSpecificReturnType>
|
|
||||||
<PossiblyInvalidArrayOffset>
|
|
||||||
<code>self::$expectedContainerAttributes[$containerClass]</code>
|
|
||||||
<code>self::$expectedContainerAttributes[$containerClass]</code>
|
|
||||||
<code>self::$expectedRouterAttributes[$routerClass]</code>
|
|
||||||
<code>self::$rendererConfigProviders[$rendererClass]</code>
|
|
||||||
<code>self::$routerConfigProviders[$routerClass]</code>
|
|
||||||
</PossiblyInvalidArrayOffset>
|
|
||||||
</file>
|
|
||||||
<file src="test/MezzioInstallerTest/OptionalPackagesTestCase.php">
|
|
||||||
<MixedArgument>
|
|
||||||
<code><![CDATA[$properties['devDependencies']]]></code>
|
|
||||||
<code><![CDATA[$r->getValue($installer)]]></code>
|
|
||||||
<code><![CDATA[$r->getValue($installer)]]></code>
|
|
||||||
<code>$whitelist</code>
|
|
||||||
</MixedArgument>
|
|
||||||
<MixedArrayAccess>
|
|
||||||
<code><![CDATA[$composerJson['require']]]></code>
|
|
||||||
<code><![CDATA[$composerJson['require-dev']]]></code>
|
|
||||||
<code><![CDATA[$r->getValue($installer)['extra']]]></code>
|
|
||||||
</MixedArrayAccess>
|
|
||||||
<MixedAssignment>
|
|
||||||
<code>$composerJson</code>
|
|
||||||
<code>$whitelist</code>
|
|
||||||
</MixedAssignment>
|
|
||||||
<MixedInferredReturnType>
|
|
||||||
<code>array</code>
|
|
||||||
<code>array</code>
|
|
||||||
</MixedInferredReturnType>
|
|
||||||
<MixedReturnStatement>
|
|
||||||
<code><![CDATA[$this->getInstallerProperty($installer, 'composerDefinition')]]></code>
|
|
||||||
<code><![CDATA[$this->getInstallerProperty($installer, 'config')]]></code>
|
|
||||||
</MixedReturnStatement>
|
|
||||||
<PossiblyUnusedProperty>
|
|
||||||
<code>$composerData</code>
|
|
||||||
</PossiblyUnusedProperty>
|
|
||||||
</file>
|
|
||||||
<file src="test/MezzioInstallerTest/ProcessAnswersTest.php">
|
|
||||||
<MixedArgument>
|
|
||||||
<code>$question</code>
|
|
||||||
<code>$question</code>
|
|
||||||
<code>$question</code>
|
|
||||||
<code>$question</code>
|
|
||||||
<code>$question</code>
|
|
||||||
<code>$question</code>
|
|
||||||
</MixedArgument>
|
|
||||||
<MixedArrayAccess>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['template-engine']]]></code>
|
|
||||||
</MixedArrayAccess>
|
|
||||||
<MixedAssignment>
|
|
||||||
<code>$question</code>
|
|
||||||
<code>$question</code>
|
|
||||||
<code>$question</code>
|
|
||||||
<code>$question</code>
|
|
||||||
<code>$question</code>
|
|
||||||
<code>$question</code>
|
|
||||||
</MixedAssignment>
|
|
||||||
</file>
|
|
||||||
<file src="test/MezzioInstallerTest/ProjectSandboxTrait.php">
|
|
||||||
<MixedArgumentTypeCoercion>
|
|
||||||
<code><![CDATA[$this->autoloader]]></code>
|
|
||||||
</MixedArgumentTypeCoercion>
|
|
||||||
<MixedAssignment>
|
|
||||||
<code><![CDATA[$this->container]]></code>
|
|
||||||
</MixedAssignment>
|
|
||||||
<MixedInferredReturnType>
|
|
||||||
<code>ContainerInterface</code>
|
|
||||||
</MixedInferredReturnType>
|
|
||||||
<UnresolvableInclude>
|
|
||||||
<code>require $path</code>
|
|
||||||
</UnresolvableInclude>
|
|
||||||
</file>
|
|
||||||
<file src="test/MezzioInstallerTest/RemoveDevDependenciesTest.php">
|
|
||||||
<MixedAssignment>
|
|
||||||
<code><![CDATA[$this->devDependencies]]></code>
|
|
||||||
</MixedAssignment>
|
|
||||||
</file>
|
|
||||||
<file src="test/MezzioInstallerTest/RequestInstallTypeTest.php">
|
|
||||||
<MixedInferredReturnType>
|
|
||||||
<code>array</code>
|
|
||||||
</MixedInferredReturnType>
|
|
||||||
</file>
|
|
||||||
<file src="test/MezzioInstallerTest/RoutersTest.php">
|
|
||||||
<MixedArgument>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['router']]]></code>
|
|
||||||
</MixedArgument>
|
|
||||||
<MixedArrayAccess>
|
|
||||||
<code><![CDATA[$config['dependencies']]]></code>
|
|
||||||
<code><![CDATA[$config['dependencies'][$dependencyKey]]]></code>
|
|
||||||
<code><![CDATA[$config['dependencies'][$dependencyKey][RouterInterface::class]]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['router']]]></code>
|
|
||||||
</MixedArrayAccess>
|
|
||||||
<MixedAssignment>
|
|
||||||
<code>$config</code>
|
|
||||||
</MixedAssignment>
|
|
||||||
<MixedInferredReturnType>
|
|
||||||
<code>array</code>
|
|
||||||
</MixedInferredReturnType>
|
|
||||||
</file>
|
|
||||||
<file src="test/MezzioInstallerTest/SetupDataAndCacheDirTest.php">
|
|
||||||
<UnusedProperty>
|
|
||||||
<code>$project</code>
|
|
||||||
</UnusedProperty>
|
|
||||||
</file>
|
|
||||||
<file src="test/MezzioInstallerTest/TemplateRenderersTest.php">
|
|
||||||
<MixedArgument>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['router']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['template-engine']]]></code>
|
|
||||||
</MixedArgument>
|
|
||||||
<MixedArrayAccess>
|
|
||||||
<code><![CDATA[$config['dependencies']]]></code>
|
|
||||||
<code><![CDATA[$config['dependencies']['factories']]]></code>
|
|
||||||
<code><![CDATA[$config['dependencies']['factories'][ErrorHandler::class]]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['container']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['router']]]></code>
|
|
||||||
<code><![CDATA[$config['questions']['template-engine']]]></code>
|
|
||||||
</MixedArrayAccess>
|
|
||||||
<MixedAssignment>
|
|
||||||
<code>$config</code>
|
|
||||||
</MixedAssignment>
|
|
||||||
</file>
|
|
||||||
<file src="test/MezzioInstallerTest/UpdateRootPackageTest.php">
|
|
||||||
<MixedArgumentTypeCoercion>
|
|
||||||
<code>$property</code>
|
|
||||||
</MixedArgumentTypeCoercion>
|
|
||||||
</file>
|
|
||||||
</files>
|
|
@ -1,23 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<psalm
|
|
||||||
cacheDirectory="./.psalm-cache"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xmlns="https://getpsalm.org/schema/config"
|
|
||||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
|
||||||
errorLevel="1"
|
|
||||||
findUnusedPsalmSuppress="true"
|
|
||||||
findUnusedCode="true"
|
|
||||||
findUnusedBaselineEntry="true"
|
|
||||||
errorBaseline="psalm-baseline.xml"
|
|
||||||
>
|
|
||||||
<projectFiles>
|
|
||||||
<directory name="src"/>
|
|
||||||
<directory name="test"/>
|
|
||||||
<ignoreFiles>
|
|
||||||
<directory name="vendor"/>
|
|
||||||
</ignoreFiles>
|
|
||||||
</projectFiles>
|
|
||||||
<plugins>
|
|
||||||
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
|
|
||||||
</plugins>
|
|
||||||
</psalm>
|
|
@ -1,19 +0,0 @@
|
|||||||
RewriteEngine On
|
|
||||||
# The following rule allows authentication to work with fast-cgi
|
|
||||||
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
|
||||||
# The following rule tells Apache that if the requested filename
|
|
||||||
# exists, simply serve it.
|
|
||||||
RewriteCond %{REQUEST_FILENAME} -f [OR]
|
|
||||||
RewriteCond %{REQUEST_FILENAME} -l [OR]
|
|
||||||
RewriteCond %{REQUEST_FILENAME} -d
|
|
||||||
RewriteRule ^ - [NC,L]
|
|
||||||
|
|
||||||
# The following rewrites all other queries to index.php. The
|
|
||||||
# condition ensures that if you are using Apache aliases to do
|
|
||||||
# mass virtual hosting, the base path will be prepended to
|
|
||||||
# allow proper resolution of the index.php file; it will work
|
|
||||||
# in non-aliased environments as well, providing a safe, one-size
|
|
||||||
# fits all solution.
|
|
||||||
RewriteCond $0::%{REQUEST_URI} ^([^:]*+(?::[^:]*+)*?)::(/.+?)\1$
|
|
||||||
RewriteRule .+ - [E=BASE:%2]
|
|
||||||
RewriteRule .* %{ENV:BASE}index.php [NC,L]
|
|
@ -1,30 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
// Delegate static file requests back to the PHP built-in webserver
|
|
||||||
if (PHP_SAPI === 'cli-server' && $_SERVER['SCRIPT_FILENAME'] !== __FILE__) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
chdir(dirname(__DIR__));
|
|
||||||
require 'vendor/autoload.php';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Self-called anonymous function that creates its own scope and keeps the global namespace clean.
|
|
||||||
*/
|
|
||||||
(function () {
|
|
||||||
/** @var \Psr\Container\ContainerInterface $container */
|
|
||||||
$container = require 'config/container.php';
|
|
||||||
|
|
||||||
/** @var \Mezzio\Application $app */
|
|
||||||
$app = $container->get(\Mezzio\Application::class);
|
|
||||||
$factory = $container->get(\Mezzio\MiddlewareFactory::class);
|
|
||||||
|
|
||||||
// Execute programmatic/declarative middleware pipeline and routing
|
|
||||||
// configuration statements
|
|
||||||
(require 'config/pipeline.php')($app, $factory, $container);
|
|
||||||
(require 'config/routes.php')($app, $factory, $container);
|
|
||||||
|
|
||||||
$app->run();
|
|
||||||
})();
|
|
@ -1,56 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The configuration provider for the App module
|
|
||||||
*
|
|
||||||
* @see https://docs.laminas.dev/laminas-component-installer/
|
|
||||||
*/
|
|
||||||
class ConfigProvider
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Returns the configuration array
|
|
||||||
*
|
|
||||||
* To add a bit of a structure, each section is defined in a separate
|
|
||||||
* method which returns an array with its configuration.
|
|
||||||
*/
|
|
||||||
public function __invoke(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'dependencies' => $this->getDependencies(),
|
|
||||||
'templates' => $this->getTemplates(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the container dependencies
|
|
||||||
*/
|
|
||||||
public function getDependencies(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'invokables' => [
|
|
||||||
Handler\PingHandler::class => Handler\PingHandler::class,
|
|
||||||
],
|
|
||||||
'factories' => [
|
|
||||||
Handler\HomePageHandler::class => Handler\HomePageHandlerFactory::class,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the templates configuration
|
|
||||||
*/
|
|
||||||
public function getTemplates(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'paths' => [
|
|
||||||
'app' => [__DIR__ . '/../templates/app'],
|
|
||||||
'error' => [__DIR__ . '/../templates/error'],
|
|
||||||
'layout' => [__DIR__ . '/../templates/layout'],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Handler;
|
|
||||||
|
|
||||||
use Chubbyphp\Container\MinimalContainer;
|
|
||||||
use DI\Container as PHPDIContainer;
|
|
||||||
use Laminas\Diactoros\Response\HtmlResponse;
|
|
||||||
use Laminas\Diactoros\Response\JsonResponse;
|
|
||||||
use Laminas\ServiceManager\ServiceManager;
|
|
||||||
use Mezzio\LaminasView\LaminasViewRenderer;
|
|
||||||
use Mezzio\Plates\PlatesRenderer;
|
|
||||||
use Mezzio\Router\FastRouteRouter;
|
|
||||||
use Mezzio\Router\LaminasRouter;
|
|
||||||
use Mezzio\Router\RouterInterface;
|
|
||||||
use Mezzio\Template\TemplateRendererInterface;
|
|
||||||
use Mezzio\Twig\TwigRenderer;
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
|
||||||
use Psr\Http\Server\RequestHandlerInterface;
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
||||||
|
|
||||||
class HomePageHandler implements RequestHandlerInterface
|
|
||||||
{
|
|
||||||
public function __construct(
|
|
||||||
private RouterInterface $router,
|
|
||||||
private ?TemplateRendererInterface $template = null
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function handle(ServerRequestInterface $request): ResponseInterface
|
|
||||||
{
|
|
||||||
$data = [];
|
|
||||||
return new HtmlResponse($this->template->render('app::home-page', $data));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Handler;
|
|
||||||
|
|
||||||
use Mezzio\Router\RouterInterface;
|
|
||||||
use Mezzio\Template\TemplateRendererInterface;
|
|
||||||
use Psr\Container\ContainerInterface;
|
|
||||||
use Psr\Http\Server\RequestHandlerInterface;
|
|
||||||
|
|
||||||
use function assert;
|
|
||||||
|
|
||||||
class HomePageHandlerFactory
|
|
||||||
{
|
|
||||||
public function __invoke(ContainerInterface $container): RequestHandlerInterface
|
|
||||||
{
|
|
||||||
$router = $container->get(RouterInterface::class);
|
|
||||||
assert($router instanceof RouterInterface);
|
|
||||||
|
|
||||||
$template = $container->has(TemplateRendererInterface::class)
|
|
||||||
? $container->get(TemplateRendererInterface::class)
|
|
||||||
: null;
|
|
||||||
assert($template instanceof TemplateRendererInterface || null === $template);
|
|
||||||
|
|
||||||
return new HomePageHandler($router, $template);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Handler;
|
|
||||||
|
|
||||||
use Laminas\Diactoros\Response\JsonResponse;
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
|
||||||
use Psr\Http\Server\RequestHandlerInterface;
|
|
||||||
|
|
||||||
use function time;
|
|
||||||
|
|
||||||
class PingHandler implements RequestHandlerInterface
|
|
||||||
{
|
|
||||||
public function handle(ServerRequestInterface $request): ResponseInterface
|
|
||||||
{
|
|
||||||
return new JsonResponse(['ack' => time()]);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Login;
|
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
|
||||||
use Psr\Http\Server\RequestHandlerInterface;
|
|
||||||
use Laminas\Diactoros\Response\HtmlResponse;
|
|
||||||
use Mezzio\Template\TemplateRendererInterface;
|
|
||||||
|
|
||||||
class LoginHandler implements RequestHandlerInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var TemplateRendererInterface
|
|
||||||
*/
|
|
||||||
private $renderer;
|
|
||||||
|
|
||||||
public function __construct(TemplateRendererInterface $renderer)
|
|
||||||
{
|
|
||||||
$this->renderer = $renderer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function handle(ServerRequestInterface $request) : ResponseInterface
|
|
||||||
{
|
|
||||||
// Do some work...
|
|
||||||
// Render and return a response:
|
|
||||||
return new HtmlResponse($this->renderer->render(
|
|
||||||
'app::login',
|
|
||||||
[] // parameters to pass to template
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Login;
|
|
||||||
|
|
||||||
use Mezzio\Template\TemplateRendererInterface;
|
|
||||||
use Psr\Container\ContainerInterface;
|
|
||||||
|
|
||||||
class LoginHandlerFactory
|
|
||||||
{
|
|
||||||
public function __invoke(ContainerInterface $container) : LoginHandler
|
|
||||||
{
|
|
||||||
return new LoginHandler($container->get(TemplateRendererInterface::class));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
<?php $this->layout('layout::default', ['title' => 'Home']) ?>
|
|
||||||
<div>
|
|
||||||
<h1>Slovocast</h1>
|
|
||||||
</div>
|
|
@ -1 +0,0 @@
|
|||||||
Template for App\Login\LoginHandler
|
|
@ -1,9 +0,0 @@
|
|||||||
<?php $this->layout('layout::default', ['title' => '404 Not Found']) ?>
|
|
||||||
|
|
||||||
<h1>Oops!</h1>
|
|
||||||
<h2>This is awkward.</h2>
|
|
||||||
<p>We encountered a 404 Not Found error.</p>
|
|
||||||
<p>
|
|
||||||
You are looking for something that doesn't exist or may have moved. Check out one of the links on this page
|
|
||||||
or head back to <a href="/">Home</a>.
|
|
||||||
</p>
|
|
@ -1,11 +0,0 @@
|
|||||||
<?php $this->layout('layout::default', ['title' => sprintf('%d %s', $status, $reason)]) ?>
|
|
||||||
|
|
||||||
<h1>Oops!</h1>
|
|
||||||
<h2>This is awkward.</h2>
|
|
||||||
<p>We encountered a <?=$this->e($status)?> <?=$this->e($reason)?> error.</p>
|
|
||||||
<?php if ($status == 404) : ?>
|
|
||||||
<p>
|
|
||||||
You are looking for something that doesn't exist or may have moved. Check out one of the links on this page
|
|
||||||
or head back to <a href="/">Home</a>.
|
|
||||||
</p>
|
|
||||||
<?php endif; ?>
|
|
@ -1,19 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
|
||||||
<title><?=$this->e($title)?> - Slovocast</title>
|
|
||||||
<?=$this->section('stylesheets')?>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<header>
|
|
||||||
<div>Slovocast</div>
|
|
||||||
</header>
|
|
||||||
<main>
|
|
||||||
<?= $this->section('content'); ?>
|
|
||||||
</main>
|
|
||||||
<?=$this->section('javascript')?>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
16
app/src/frontend/layout.tsx
Normal file
16
app/src/frontend/layout.tsx
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { FC } from 'hono/jsx';
|
||||||
|
|
||||||
|
const Layout: FC = (props) => {
|
||||||
|
return (
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>{props.siteData.title}</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{props.children}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Layout;
|
9
app/src/index.ts
Normal file
9
app/src/index.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { Hono } from 'hono';
|
||||||
|
|
||||||
|
const app = new Hono();
|
||||||
|
|
||||||
|
app.get('/', (c) => {
|
||||||
|
return c.text('Hello Hono!');
|
||||||
|
});
|
||||||
|
|
||||||
|
export default app;
|
4
app/src/model/SiteData.ts
Normal file
4
app/src/model/SiteData.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export default interface SiteData {
|
||||||
|
title: string,
|
||||||
|
description: string,
|
||||||
|
};
|
@ -1,38 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace AppTest\Handler;
|
|
||||||
|
|
||||||
use App\Handler\HomePageHandler;
|
|
||||||
use App\Handler\HomePageHandlerFactory;
|
|
||||||
use AppTest\InMemoryContainer;
|
|
||||||
use Mezzio\Router\RouterInterface;
|
|
||||||
use Mezzio\Template\TemplateRendererInterface;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
class HomePageHandlerFactoryTest extends TestCase
|
|
||||||
{
|
|
||||||
public function testFactoryWithoutTemplate(): void
|
|
||||||
{
|
|
||||||
$container = new InMemoryContainer();
|
|
||||||
$container->setService(RouterInterface::class, $this->createMock(RouterInterface::class));
|
|
||||||
|
|
||||||
$factory = new HomePageHandlerFactory();
|
|
||||||
$homePage = $factory($container);
|
|
||||||
|
|
||||||
self::assertInstanceOf(HomePageHandler::class, $homePage);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testFactoryWithTemplate(): void
|
|
||||||
{
|
|
||||||
$container = new InMemoryContainer();
|
|
||||||
$container->setService(RouterInterface::class, $this->createMock(RouterInterface::class));
|
|
||||||
$container->setService(TemplateRendererInterface::class, $this->createMock(TemplateRendererInterface::class));
|
|
||||||
|
|
||||||
$factory = new HomePageHandlerFactory();
|
|
||||||
$homePage = $factory($container);
|
|
||||||
|
|
||||||
self::assertInstanceOf(HomePageHandler::class, $homePage);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace AppTest\Handler;
|
|
||||||
|
|
||||||
use App\Handler\HomePageHandler;
|
|
||||||
use Laminas\Diactoros\Response\HtmlResponse;
|
|
||||||
use Laminas\Diactoros\Response\JsonResponse;
|
|
||||||
use Mezzio\Router\RouterInterface;
|
|
||||||
use Mezzio\Template\TemplateRendererInterface;
|
|
||||||
use PHPUnit\Framework\MockObject\MockObject;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
use Psr\Container\ContainerInterface;
|
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
|
||||||
|
|
||||||
class HomePageHandlerTest extends TestCase
|
|
||||||
{
|
|
||||||
/** @var ContainerInterface&MockObject */
|
|
||||||
protected $container;
|
|
||||||
|
|
||||||
/** @var RouterInterface&MockObject */
|
|
||||||
protected $router;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
$this->container = $this->createMock(ContainerInterface::class);
|
|
||||||
$this->router = $this->createMock(RouterInterface::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testReturnsJsonResponseWhenNoTemplateRendererProvided(): void
|
|
||||||
{
|
|
||||||
$homePage = new HomePageHandler(
|
|
||||||
$this->container::class,
|
|
||||||
$this->router,
|
|
||||||
null
|
|
||||||
);
|
|
||||||
$response = $homePage->handle(
|
|
||||||
$this->createMock(ServerRequestInterface::class)
|
|
||||||
);
|
|
||||||
|
|
||||||
self::assertInstanceOf(JsonResponse::class, $response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testReturnsHtmlResponseWhenTemplateRendererProvided(): void
|
|
||||||
{
|
|
||||||
$renderer = $this->createMock(TemplateRendererInterface::class);
|
|
||||||
$renderer
|
|
||||||
->expects($this->once())
|
|
||||||
->method('render')
|
|
||||||
->with('app::home-page', $this->isType('array'))
|
|
||||||
->willReturn('');
|
|
||||||
|
|
||||||
$homePage = new HomePageHandler(
|
|
||||||
$this->container::class,
|
|
||||||
$this->router,
|
|
||||||
$renderer
|
|
||||||
);
|
|
||||||
|
|
||||||
$response = $homePage->handle(
|
|
||||||
$this->createMock(ServerRequestInterface::class)
|
|
||||||
);
|
|
||||||
|
|
||||||
self::assertInstanceOf(HtmlResponse::class, $response);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace AppTest\Handler;
|
|
||||||
|
|
||||||
use App\Handler\PingHandler;
|
|
||||||
use Laminas\Diactoros\Response\JsonResponse;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
|
||||||
|
|
||||||
use function json_decode;
|
|
||||||
use function property_exists;
|
|
||||||
|
|
||||||
use const JSON_THROW_ON_ERROR;
|
|
||||||
|
|
||||||
class PingHandlerTest extends TestCase
|
|
||||||
{
|
|
||||||
public function testResponse(): void
|
|
||||||
{
|
|
||||||
$pingHandler = new PingHandler();
|
|
||||||
$response = $pingHandler->handle(
|
|
||||||
$this->createMock(ServerRequestInterface::class)
|
|
||||||
);
|
|
||||||
|
|
||||||
$json = json_decode((string) $response->getBody(), null, 512, JSON_THROW_ON_ERROR);
|
|
||||||
|
|
||||||
self::assertInstanceOf(JsonResponse::class, $response);
|
|
||||||
self::assertTrue(property_exists($json, 'ack') && $json->ack !== null);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace AppTest;
|
|
||||||
|
|
||||||
use Psr\Container\ContainerInterface;
|
|
||||||
use RuntimeException;
|
|
||||||
|
|
||||||
use function array_key_exists;
|
|
||||||
use function sprintf;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A PSR Container stub. Useful for testing factories without excessive mocking
|
|
||||||
*/
|
|
||||||
class InMemoryContainer implements ContainerInterface
|
|
||||||
{
|
|
||||||
/** @var array<string, mixed> */
|
|
||||||
public array $services = [];
|
|
||||||
|
|
||||||
public function setService(string $name, mixed $service): void
|
|
||||||
{
|
|
||||||
$this->services[$name] = $service;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $id
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function get($id)
|
|
||||||
{
|
|
||||||
if (! $this->has($id)) {
|
|
||||||
throw new RuntimeException(sprintf('Service not found "%s"', $id));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->services[$id];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $id
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function has($id)
|
|
||||||
{
|
|
||||||
return array_key_exists($id, $this->services);
|
|
||||||
}
|
|
||||||
}
|
|
7
app/tsconfig.json
Normal file
7
app/tsconfig.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"strict": true,
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
"jsxImportSource": "hono/jsx"
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +0,0 @@
|
|||||||
[*.{html,js,jsx,ts,tsx}]
|
|
||||||
indent_type = space
|
|
||||||
indent_size = 2
|
|
175
frontend/.gitignore
vendored
175
frontend/.gitignore
vendored
@ -1,175 +0,0 @@
|
|||||||
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
|
|
||||||
|
|
||||||
# Logs
|
|
||||||
|
|
||||||
logs
|
|
||||||
_.log
|
|
||||||
npm-debug.log_
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
lerna-debug.log*
|
|
||||||
.pnpm-debug.log*
|
|
||||||
|
|
||||||
# Caches
|
|
||||||
|
|
||||||
.cache
|
|
||||||
|
|
||||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
||||||
|
|
||||||
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
|
|
||||||
|
|
||||||
# Runtime data
|
|
||||||
|
|
||||||
pids
|
|
||||||
_.pid
|
|
||||||
_.seed
|
|
||||||
*.pid.lock
|
|
||||||
|
|
||||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
||||||
|
|
||||||
lib-cov
|
|
||||||
|
|
||||||
# Coverage directory used by tools like istanbul
|
|
||||||
|
|
||||||
coverage
|
|
||||||
*.lcov
|
|
||||||
|
|
||||||
# nyc test coverage
|
|
||||||
|
|
||||||
.nyc_output
|
|
||||||
|
|
||||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
||||||
|
|
||||||
.grunt
|
|
||||||
|
|
||||||
# Bower dependency directory (https://bower.io/)
|
|
||||||
|
|
||||||
bower_components
|
|
||||||
|
|
||||||
# node-waf configuration
|
|
||||||
|
|
||||||
.lock-wscript
|
|
||||||
|
|
||||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
||||||
|
|
||||||
build/Release
|
|
||||||
|
|
||||||
# Dependency directories
|
|
||||||
|
|
||||||
node_modules/
|
|
||||||
jspm_packages/
|
|
||||||
|
|
||||||
# Snowpack dependency directory (https://snowpack.dev/)
|
|
||||||
|
|
||||||
web_modules/
|
|
||||||
|
|
||||||
# TypeScript cache
|
|
||||||
|
|
||||||
*.tsbuildinfo
|
|
||||||
|
|
||||||
# Optional npm cache directory
|
|
||||||
|
|
||||||
.npm
|
|
||||||
|
|
||||||
# Optional eslint cache
|
|
||||||
|
|
||||||
.eslintcache
|
|
||||||
|
|
||||||
# Optional stylelint cache
|
|
||||||
|
|
||||||
.stylelintcache
|
|
||||||
|
|
||||||
# Microbundle cache
|
|
||||||
|
|
||||||
.rpt2_cache/
|
|
||||||
.rts2_cache_cjs/
|
|
||||||
.rts2_cache_es/
|
|
||||||
.rts2_cache_umd/
|
|
||||||
|
|
||||||
# Optional REPL history
|
|
||||||
|
|
||||||
.node_repl_history
|
|
||||||
|
|
||||||
# Output of 'npm pack'
|
|
||||||
|
|
||||||
*.tgz
|
|
||||||
|
|
||||||
# Yarn Integrity file
|
|
||||||
|
|
||||||
.yarn-integrity
|
|
||||||
|
|
||||||
# dotenv environment variable files
|
|
||||||
|
|
||||||
.env
|
|
||||||
.env.development.local
|
|
||||||
.env.test.local
|
|
||||||
.env.production.local
|
|
||||||
.env.local
|
|
||||||
|
|
||||||
# parcel-bundler cache (https://parceljs.org/)
|
|
||||||
|
|
||||||
.parcel-cache
|
|
||||||
|
|
||||||
# Next.js build output
|
|
||||||
|
|
||||||
.next
|
|
||||||
out
|
|
||||||
|
|
||||||
# Nuxt.js build / generate output
|
|
||||||
|
|
||||||
.nuxt
|
|
||||||
dist
|
|
||||||
|
|
||||||
# Gatsby files
|
|
||||||
|
|
||||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
||||||
|
|
||||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
||||||
|
|
||||||
# public
|
|
||||||
|
|
||||||
# vuepress build output
|
|
||||||
|
|
||||||
.vuepress/dist
|
|
||||||
|
|
||||||
# vuepress v2.x temp and cache directory
|
|
||||||
|
|
||||||
.temp
|
|
||||||
|
|
||||||
# Docusaurus cache and generated files
|
|
||||||
|
|
||||||
.docusaurus
|
|
||||||
|
|
||||||
# Serverless directories
|
|
||||||
|
|
||||||
.serverless/
|
|
||||||
|
|
||||||
# FuseBox cache
|
|
||||||
|
|
||||||
.fusebox/
|
|
||||||
|
|
||||||
# DynamoDB Local files
|
|
||||||
|
|
||||||
.dynamodb/
|
|
||||||
|
|
||||||
# TernJS port file
|
|
||||||
|
|
||||||
.tern-port
|
|
||||||
|
|
||||||
# Stores VSCode versions used for testing VSCode extensions
|
|
||||||
|
|
||||||
.vscode-test
|
|
||||||
|
|
||||||
# yarn v2
|
|
||||||
|
|
||||||
.yarn/cache
|
|
||||||
.yarn/unplugged
|
|
||||||
.yarn/build-state.yml
|
|
||||||
.yarn/install-state.gz
|
|
||||||
.pnp.*
|
|
||||||
|
|
||||||
# IntelliJ based IDEs
|
|
||||||
.idea
|
|
||||||
|
|
||||||
# Finder (MacOS) folder config
|
|
||||||
.DS_Store
|
|
@ -1,15 +0,0 @@
|
|||||||
# slovocast-frontend
|
|
||||||
|
|
||||||
To install dependencies:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bun install
|
|
||||||
```
|
|
||||||
|
|
||||||
To run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bun run index.ts
|
|
||||||
```
|
|
||||||
|
|
||||||
This project was created using `bun init` in bun v1.0.24. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
|
@ -1,4 +0,0 @@
|
|||||||
await Bun.build({
|
|
||||||
entrypoints: [ './src/index.ts' ],
|
|
||||||
outdir: './public/js'
|
|
||||||
});
|
|
Binary file not shown.
@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "slovocast-frontend",
|
|
||||||
"module": "index.ts",
|
|
||||||
"type": "module",
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/bun": "latest",
|
|
||||||
"@types/mithril": "^2.2.6"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"typescript": "^5.0.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"bun": "^1.0.29",
|
|
||||||
"mithril": "^2.2.2"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<title>Slovocast</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<script src="js/index.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
File diff suppressed because it is too large
Load Diff
@ -1,21 +0,0 @@
|
|||||||
import m from 'mithril';
|
|
||||||
import User from '../models/User';
|
|
||||||
|
|
||||||
const users: User[] = [
|
|
||||||
new User('U1'),
|
|
||||||
new User('U2'),
|
|
||||||
new User('U3')
|
|
||||||
];
|
|
||||||
|
|
||||||
const oninit = function () {
|
|
||||||
// get the users value
|
|
||||||
};
|
|
||||||
|
|
||||||
const view = function () {
|
|
||||||
return m('.UserList',
|
|
||||||
m('ul', users.map(u => m('li', u.getUsername())))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const UserList = { oninit, view };
|
|
||||||
export default UserList;
|
|
@ -1,11 +0,0 @@
|
|||||||
import m from 'mithril';
|
|
||||||
import UserList from './components/UserList';
|
|
||||||
|
|
||||||
const App = {
|
|
||||||
view: function() {
|
|
||||||
return m('body', [ UserList ]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//@ts-ignore This will be rendered and run on the DOM of a web page
|
|
||||||
m.mount(document.body, App);
|
|
@ -1,12 +0,0 @@
|
|||||||
export default class User {
|
|
||||||
private username: string;
|
|
||||||
|
|
||||||
public constructor(username: string) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getUsername(): string {
|
|
||||||
return this.username;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"lib": ["ESNext"],
|
|
||||||
"target": "ESNext",
|
|
||||||
"module": "ESNext",
|
|
||||||
"moduleDetection": "force",
|
|
||||||
"jsx": "react-jsx",
|
|
||||||
"allowJs": true,
|
|
||||||
|
|
||||||
/* Bundler mode */
|
|
||||||
"moduleResolution": "bundler",
|
|
||||||
"allowImportingTsExtensions": true,
|
|
||||||
"verbatimModuleSyntax": true,
|
|
||||||
"noEmit": true,
|
|
||||||
|
|
||||||
/* Linting */
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"strict": true,
|
|
||||||
"noFallthroughCasesInSwitch": true,
|
|
||||||
"forceConsistentCasingInFileNames": true
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user