- WIP on skeleton
This commit is contained in:
parent
fdca37a79d
commit
78d2d9d291
@ -8,17 +8,27 @@
|
|||||||
],
|
],
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.2",
|
"php": "^8.4",
|
||||||
"ext-apcu": "*",
|
"ext-apcu": "*",
|
||||||
|
"ext-sodium": "*",
|
||||||
|
"ext-bcmath": "*",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
|
"ext-readline": "*",
|
||||||
"league/route": "^5.0.0-dev",
|
"league/route": "^5.0.0-dev",
|
||||||
"laminas/laminas-diactoros": "2.24.x-dev",
|
"laminas/laminas-diactoros": "2.24.x-dev",
|
||||||
"laminas/laminas-httphandlerrunner": "2.5.x-dev",
|
"laminas/laminas-httphandlerrunner": "2.5.x-dev",
|
||||||
"vlucas/phpdotenv": "^3.4@dev",
|
"vlucas/phpdotenv": "^3.4@dev",
|
||||||
"middlewares/whoops": "dev-master",
|
"middlewares/whoops": "dev-master",
|
||||||
"ralouphie/getallheaders": "dev-master",
|
"ralouphie/getallheaders": "3.x",
|
||||||
|
"guzzlehttp/guzzle": "7.9.x-dev",
|
||||||
|
"symfony/mailer": "6.3.x-dev",
|
||||||
|
"league/oauth2-client": "dev-master",
|
||||||
|
"php-di/php-di": "dev-master",
|
||||||
|
"league/commonmark": "^2.7@dev",
|
||||||
|
"assets-package/ace": "dev-master",
|
||||||
"mcnd/dump": "dev-master",
|
"mcnd/dump": "dev-master",
|
||||||
"mcnd/storage": "dev-master",
|
"mcnd/storage": "dev-master",
|
||||||
|
"mcnd/cli": "dev-master",
|
||||||
"mcnd/event": "dev-master",
|
"mcnd/event": "dev-master",
|
||||||
"mcnd/ulmus": "dev-master",
|
"mcnd/ulmus": "dev-master",
|
||||||
"mcnd/ulmus-api": "dev-master",
|
"mcnd/ulmus-api": "dev-master",
|
||||||
@ -27,6 +37,7 @@
|
|||||||
"mcnd/picea-ui": "dev-master",
|
"mcnd/picea-ui": "dev-master",
|
||||||
"mcnd/picea-asset": "dev-master",
|
"mcnd/picea-asset": "dev-master",
|
||||||
"mcnd/cronard": "dev-master",
|
"mcnd/cronard": "dev-master",
|
||||||
|
"mcnd/lean-api": "dev-master",
|
||||||
"mcnd/lean-console": "dev-master",
|
"mcnd/lean-console": "dev-master",
|
||||||
"mcnd/kash": "dev-master",
|
"mcnd/kash": "dev-master",
|
||||||
"mcnd/taxus": "dev-master",
|
"mcnd/taxus": "dev-master",
|
||||||
@ -39,6 +50,10 @@
|
|||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://git.mcnd.ca/mcndave/cronard.git"
|
"url": "https://git.mcnd.ca/mcndave/cronard.git"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/cli.git"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://git.mcnd.ca/mcndave/dump.git"
|
"url": "https://git.mcnd.ca/mcndave/dump.git"
|
||||||
@ -51,6 +66,10 @@
|
|||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://git.mcnd.ca/mcndave/lean.git"
|
"url": "https://git.mcnd.ca/mcndave/lean.git"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/lean-api.git"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://git.mcnd.ca/mcndave/lean-console.git"
|
"url": "https://git.mcnd.ca/mcndave/lean-console.git"
|
||||||
@ -118,6 +137,10 @@
|
|||||||
{
|
{
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://git.mcnd.ca/mcndave/negundo-client.git"
|
"url": "https://git.mcnd.ca/mcndave/negundo-client.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/assets-package/ace.git"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -136,6 +159,7 @@
|
|||||||
"extra" : {
|
"extra" : {
|
||||||
"lean" : {
|
"lean" : {
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
"order": 1000,
|
||||||
"definitions" : [
|
"definitions" : [
|
||||||
"meta/definitions/definitions.php",
|
"meta/definitions/definitions.php",
|
||||||
"meta/definitions/storage.php",
|
"meta/definitions/storage.php",
|
||||||
|
|||||||
28
skeleton/src/Lib/ApiTrait.php
Normal file
28
skeleton/src/Lib/ApiTrait.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace %NAMESPACE%\Lib;
|
||||||
|
|
||||||
|
use Picea\Picea;
|
||||||
|
use Storage\Session;
|
||||||
|
use Mcnd\Event\EventManager;
|
||||||
|
use Notes\{ Attribute\Ignore, Route\Attribute\Object\Route, Security\Attribute\Security };
|
||||||
|
use Ulmus\User\Entity\{ User, UserInterface };
|
||||||
|
|
||||||
|
use %NAMESPACE%\{ Entity, Lib, Form, Factory };
|
||||||
|
|
||||||
|
#[Security(locked: false)]
|
||||||
|
#[Route(base: "/api", method: [ "GET", "POST", "PUT", "PATCH", "DELETE", ])]
|
||||||
|
trait ApiTrait {
|
||||||
|
use \Lean\ControllerTrait, \Lean\Api\LeanApiTrait {
|
||||||
|
\Lean\Api\LeanApiTrait::renderMarkdown insteadof \Lean\ControllerTrait;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
|
public UserInterface $user;
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
|
protected EventManager $eventManager;
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
|
protected Factory\FormFactoryInterface $formFactory;
|
||||||
|
}
|
||||||
@ -23,19 +23,4 @@ trait ControllerTrait {
|
|||||||
|
|
||||||
#[Ignore]
|
#[Ignore]
|
||||||
protected EventManager $eventManager;
|
protected EventManager $eventManager;
|
||||||
|
|
||||||
#[Ignore]
|
|
||||||
public function __construct(Picea $picea, Session $session, UserInterface $user, \Notes\Breadcrumb\Breadcrumb $breadcrumb, EventManager $eventManager) {
|
|
||||||
$this->initializeController($picea, $session, $user, $breadcrumb, $eventManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[Ignore]
|
|
||||||
public function initializeController(Picea $picea, Session $session, UserInterface $user, \Notes\Breadcrumb\Breadcrumb $breadcrumb, EventManager $eventManager) {
|
|
||||||
$this->picea = $picea;
|
|
||||||
$this->session = $session;
|
|
||||||
$this->eventManager = $eventManager;
|
|
||||||
$this->breadcrumb = $breadcrumb;
|
|
||||||
$this->user = $user;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2,9 +2,10 @@
|
|||||||
|
|
||||||
namespace %NAMESPACE%\Lib;
|
namespace %NAMESPACE%\Lib;
|
||||||
|
|
||||||
|
use Lean\Api\Factory\MessageFactoryInterface;
|
||||||
use Picea\Ui\Method\FormMessage;
|
use Picea\Ui\Method\FormMessage;
|
||||||
|
|
||||||
class Message implements FormMessage {
|
class Message implements FormMessage, MessageFactoryInterface {
|
||||||
|
|
||||||
const MESSAGE_TYPE = [
|
const MESSAGE_TYPE = [
|
||||||
'success' => [
|
'success' => [
|
||||||
@ -34,7 +35,7 @@ class Message implements FormMessage {
|
|||||||
|
|
||||||
public ? string $header = null;
|
public ? string $header = null;
|
||||||
|
|
||||||
public function __construct(string $message, string $type = "error", ? string $header = null, ? string $class = null)
|
public function __construct(string $message = "", string $type = "error", ? string $header = null, ? string $class = null)
|
||||||
{
|
{
|
||||||
$this->message = $message;
|
$this->message = $message;
|
||||||
|
|
||||||
@ -86,18 +87,33 @@ class Message implements FormMessage {
|
|||||||
return $this->type === "error";
|
return $this->type === "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function generateSuccess(string $message, ? string $header = null, ? string $class = null) : self
|
public static function generateSuccess(string $message, ? string $header = null, ? string $class = null) : MessageFactoryInterface
|
||||||
{
|
{
|
||||||
return new static($message, 'success', $header, $class);
|
return new static($message, 'success', $header, $class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function generateError(string $message, ? string $header = null, ? string $class = null) : self
|
public static function generateError(string $message, ? string $header = null, ? string $class = null) : MessageFactoryInterface
|
||||||
{
|
{
|
||||||
return new static($message, 'error', $header, $class);
|
return new static($message, 'error', $header, $class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function generateWarning(string $message, ? string $header = null, ? string $class = null) : self
|
public static function generateWarning(string $message, ? string $header = null, ? string $class = null) : MessageFactoryInterface
|
||||||
{
|
{
|
||||||
return new static($message, 'warning', $header, $class);
|
return new static($message, 'warning', $header, $class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function generateInformation(string $message, ?string $header = null, ?string $class = null): MessageFactoryInterface
|
||||||
|
{
|
||||||
|
return new static($message, 'information', $header, $class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function generateDebug(string $message, ?string $header = null, ?string $class = null): MessageFactoryInterface
|
||||||
|
{
|
||||||
|
return new static($message, 'debug', $header, $class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function generateTrace(string $message, ?string $header = null, ?string $class = null): MessageFactoryInterface
|
||||||
|
{
|
||||||
|
return new static($message, 'trace', $header, $class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -102,7 +102,7 @@ class Composer
|
|||||||
throw new \UnexpectedValueException("Composer file 'composer.json' could not be found within your project's root folder.");
|
throw new \UnexpectedValueException("Composer file 'composer.json' could not be found within your project's root folder.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $content ??= file_exists($path) ? json_decode(file_get_contents($path), true) : false;
|
return $content ??= file_exists($path) ? json_decode(file_get_contents($path), true, 512, \JSON_THROW_ON_ERROR) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getNamespaceFromAutoload(Event $event) : ? string
|
protected static function getNamespaceFromAutoload(Event $event) : ? string
|
||||||
@ -125,7 +125,7 @@ class Composer
|
|||||||
|
|
||||||
$event->getIO()->writeError("Your composer file do not seem to contains a valid psr-4 project pointing to the src folder.");
|
$event->getIO()->writeError("Your composer file do not seem to contains a valid psr-4 project pointing to the src folder.");
|
||||||
|
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function createPath(... $path) : string
|
protected static function createPath(... $path) : string
|
||||||
|
|||||||
@ -21,9 +21,6 @@ use function file_get_contents;
|
|||||||
#[Route(method: [ "GET", "POST" ])]
|
#[Route(method: [ "GET", "POST" ])]
|
||||||
trait ControllerTrait {
|
trait ControllerTrait {
|
||||||
|
|
||||||
##[Inject]
|
|
||||||
# public \Notes\Breadcrumb\Breadcrumb $breadcrumb;
|
|
||||||
|
|
||||||
#[Inject]
|
#[Inject]
|
||||||
public Session $session;
|
public Session $session;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user