diff --git a/LICENSE.md b/LICENSE.md index 2f875b1..6808780 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,5 +1,5 @@ # 3-Clause BSD License -Copyright © 2021 DissonancePHP. +Copyright © 2021 SymbioticPHP. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -11,7 +11,7 @@ met: notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -* Neither the name of DissonancePHP nor the names of its +* Neither the name of SymbioticPHP nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/README.md b/README.md index e7b0896..3121430 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Dissonance Web (MVP, BETA-PRE-ZERO EDITION) +# Symbiotic Web (MVP, BETA-PRE-ZERO EDITION) ### Описание **Фреймфорк создан с целью упростить интеграцию независимых небольших приложений в другие CMS и фреймворки, а также для расширения функциональности пакетов для композера.** @@ -55,11 +55,11 @@ ## Установка ``` -composer require dissonance/full +composer require symbiotic/full ``` Сразу ставьте и пакет для разработки ``` -composer require dissonance/develop +composer require symbiotic/develop ``` ## Запуск @@ -68,14 +68,14 @@ composer require dissonance/develop Если вы используете уже фреймворк, то необходимо включить режим симбиоза в конфиге ```php -$config['symbiosis'] = true; +$config['symbiotic'] = true; ``` ##### Инициализация ```php $basePath = dirname(__DIR__);// корневая папка проекта include_once $basePath . '/vendor/autoload.php'; -include $basePath.'/vendor/dissonance/full/src/dissonance.php'; +include $basePath.'/vendor/symbiotic/full/src/symbiotic.php'; // Дальше может идти код инициализации и отработки другого фреймворка... //.... @@ -91,40 +91,44 @@ include_once $basePath. '/vendor/autoload.php'; $config = [ 'debug' => true, - 'symbiosis' => true, // Режим симбиоза, если включен и фреймворк не найдет обработчик, + 'symbiotic' => true, // Режим симбиоза, если включен и фреймворк не найдет обработчик, // то он ничего не вернет и основной фреймворк смодет сам обработать запрос 'default_host' => 'localhost',// для консоли , но ее пока нет - 'uri_prefix' => 'dissonance', // Префикс в котором работет фреймворк, если пустой то работае от корня + 'uri_prefix' => 'symbiotic', // Префикс в котором работет фреймворк, если пустой то работае от корня 'base_path' => $basePath, // базовая папка проекта 'assets_prefix' => '/assets', 'storage_path' => $basePath . '/storage', // Если убрать то кеш отключится 'packages_paths' => [ $basePath . '/vendor', // Папка для приложений ], - 'bootstrappers' => [ - \Dissonance\Develop\Bootstrap\DebugBootstrap::class,/// debug only - \Dissonance\Core\Bootstrap\EventBootstrap::class, - \Dissonance\SimpleCacheFilesystem\Bootstrap::class, - \Dissonance\Packages\PackagesLoaderFilesystemBootstrap::class, - \Dissonance\Packages\PackagesBootstrap::class, - \Dissonance\Packages\ResourcesBootstrap::class, - \Dissonance\Apps\Bootstrap::class, - \Dissonance\Http\Bootstrap::class, - \Dissonance\Http\Kernel\Bootstrap::class, - \Dissonance\View\Blade\Bootstrap::class, - ], - 'providers' => [ - \Dissonance\Http\Cookie\CookiesProvider::class, - \Dissonance\Routing\SettlementsRoutingProvider::class, - \Dissonance\Session\NativeProvider::class, - ], + 'bootstrappers' => [ + \Symbiotic\Develop\Bootstrap\DebugBootstrap::class,/// debug only + \Symbiotic\Bootstrap\EventBootstrap::class, + \Symbiotic\SimpleCacheFilesystem\Bootstrap::class, + \Symbiotic\PackagesLoaderFilesystem\Bootstrap::class, + \Symbiotic\Packages\PackagesBootstrap::class, + \Symbiotic\Packages\ResourcesBootstrap::class, + \Symbiotic\Apps\Bootstrap::class, + \Symbiotic\Http\Bootstrap::class, + \Symbiotic\HttpKernel\Bootstrap::class, + \Symbiotic\CacheRouting\Bootstrap::class, + \Symbiotic\ViewBlade\Bootstrap::class, + ], + 'providers' => [ + \Symbiotic\Http\Cookie\CookiesProvider::class, + \Symbiotic\SettlementsRouting\Provider::class, + \Symbiotic\Session\NativeProvider::class, + ], + 'providers_exclude' => [ + \Symbiotic\Routing\Provider::class, + ] ]; // Базовая постройка контейнера -$core = new \Dissonance\Core\Core($config); +$core = new \Symbiotic\Core($config); // Или через билдер с кешем -$cache = new Dissonance\SimpleCacheFilesystem\SimpleCache($basePath . '/storage/cache/core'); -$core = (new \Dissonance\Core\ContainerBuilder($cache)) +$cache = new Symbiotic\SimpleCacheFilesystem\SimpleCache($basePath . '/storage/cache/core'); +$core = (new \Symbiotic\CachedContainer\ContainerBuilder($cache)) ->buildCore($config); // Запуск @@ -146,7 +150,7 @@ $core->run(); }, // Добавляем описание пакета для фреймворка "extra": { - "dissonance": { + "symbiotic": { "id": "wso.my_package_id", // ID пакета формируется на сайте фреймворка, но можно локально любой ставить // Описание приложения, пакет может и не иметь секцию приложения, а быть лишь расширением "app": { @@ -154,12 +158,12 @@ $core->run(); "parent_app": "wso", // ID родительсского приложения, если приложение плагин "name": "WSO Users exporter", // Имя приложения, используется в списке приложений и меню "routing": "\\\\MyVendor\\\\MySuperPackage\\\\Routing", // Класс роутинга, не обязательно - "controllers_namespace": "\\\\Dissonance\\\\Develop\\\\Controllers", // Базовый неймспейс для контроллеров, не обязательно + "controllers_namespace": "\\\\Symbiotic\\\\Develop\\\\Controllers", // Базовый неймспейс для контроллеров, не обязательно "version": "1.0.0", // Версия, не обязательно, плагины могут проверять и подстаиваться под изменения "providers": [ // Провайдеры приложения, не обязательно "MyVendor\\\\MySuperPackage\\\\Providers\\\\AppProvider" ], - // Не обязательно! Наследник от \\Dissonance\\App\\Application + // Не обязательно! Наследник от \\Symbiotic\\App\\Application "app_class": "MyVendor\\\\MySuperPackage\\\\MyAppContainer" }, @@ -192,7 +196,7 @@ $core->run(); // ... }, "extra": { - "dissonance": { + "symbiotic": { "id": "my_super_theme_2", // Можно указать что то одно или все вместе "public_path": "assets", // Папка со статикой, относительно корня пакета @@ -222,11 +226,11 @@ $core->run(); // ... }, "extra": { - "dissonance": { + "symbiotic": { "app": { "id": "my_package_id", // Id приложения "routing": "\\\\MyVendor\\\\MySuperPackage\\\\Routing", - "controllers_namespace": "\\\\Dissonance\\\\Develop\\\\Controllers" + "controllers_namespace": "\\\\Symbiotic\\\\Develop\\\\Controllers" }, } } @@ -256,13 +260,13 @@ vendor/ -/composer.json ``` -При необходимости можно поселить все классы для приложения фреймворка в подпапку src/Dissonance. Так не будет путаницы с функционалом вашего пакета. +При необходимости можно поселить все классы для приложения фреймворка в подпапку src/Symbiotic. Так не будет путаницы с функционалом вашего пакета. ```text vendor/ -/my_vendor -/my_package_name - -/dissonance + -/symbiotic -/assets - Статика -/js -/css @@ -271,7 +275,7 @@ vendor/ -/views -/... -/src - Ваш пакет - -/Dissonance + -/Symbiotic -/Http -/Cоntrollers -/... diff --git a/composer.json b/composer.json index 3e8a29a..69c93d5 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "dissonance/full", - "description": "Полная сборка пакетов фреймворка Dissonance.", + "name": "symbiotic/full", + "description": "Полная сборка пакетов фреймворка Symbiotic.", "license": "BSD-3-Clause", "version": "1.1.1", "authors": [{ @@ -8,12 +8,12 @@ "role": "creator" }], "keywords": [ - "dissonance", + "symbiotic", "composer apps framework", - "dissonance web" + "symbiotic web" ], "require": { - "php": ">=7.2", + "php": ">=8.0", "psr/http-server-handler": "1.0.*", "psr/http-server-middleware": "1.0.1", "psr/http-factory": "1.0.1", @@ -21,12 +21,12 @@ "psr/container": "^1.0", "psr/simple-cache": "1.*", "nyholm/psr7": ">=1.3.2", - "dissonance/ui_http_kernel": "1.*", + "symbiotic/ui_http_kernel": "1.*", "ext-json": "*" }, "autoload": { "psr-4":{ - "Dissonance\\": "src/" + "Symbiotic\\": "src/" }, "files": [ "src/core_helpers.php", @@ -34,31 +34,31 @@ ] }, "suggest": { - "dissonance/full-single": "Полная сборка в одном файле", - "dissonance/develop": " Dev app" + "symbiotic/full-single": "Полная сборка в одном файле", + "symbiotic/develop": " Dev app" }, "replace": { - "dissonance/apps": "1.0.*", - "dissonance/cached-container": "1.0.*", - "dissonance/container": "1.0.*", - "dissonance/container-contracts": "1.0.*", - "dissonance/container-traits": "1.0.*", - "dissonance/core": "1.0.*", - "dissonance/event": "1.0.*", - "dissonance/http": "1.0.*", - "dissonance/http-kernel": "1.0.*", - "dissonance/http-middlewares": "1.0.*", - "dissonance/http-response-mutable": "1.0.*", - "dissonance/mimetypes-mini": "1.0.*", - "dissonance/packages": "1.0.*", - "dissonance/packages-contracts": "1.0.*", - "dissonance/routing": "1.0.*", - "dissonance/routing-cache": "1.0.*", - "dissonance/routing-settlements": "1.0.*", - "dissonance/simple-cache-filesystem": "1.0.*", - "dissonance/http-cookie": "1.0.*", - "dissonance/contracts": "1.0.*", - "dissonance/session-native": "1.0.*", - "dissonance/view-blade": "1.0.*" + "symbiotic/apps": "1.0.*", + "symbiotic/cached-container": "1.0.*", + "symbiotic/container": "1.0.*", + "symbiotic/container-contracts": "1.0.*", + "symbiotic/container-traits": "1.0.*", + "symbiotic/core": "1.0.*", + "symbiotic/event": "1.0.*", + "symbiotic/http": "1.0.*", + "symbiotic/http-kernel": "1.0.*", + "symbiotic/http-middlewares": "1.0.*", + "symbiotic/http-response-mutable": "1.0.*", + "symbiotic/mimetypes-mini": "1.0.*", + "symbiotic/packages": "1.0.*", + "symbiotic/packages-contracts": "1.0.*", + "symbiotic/routing": "1.0.*", + "symbiotic/routing-cache": "1.0.*", + "symbiotic/routing-settlements": "1.0.*", + "symbiotic/simple-cache-filesystem": "1.0.*", + "symbiotic/http-cookie": "1.0.*", + "symbiotic/contracts": "1.0.*", + "symbiotic/session-native": "1.0.*", + "symbiotic/view-blade": "1.0.*" } } diff --git a/src/Apps/AppConfig.php b/src/Apps/AppConfig.php index 2f34d7f..80d44f3 100644 --- a/src/Apps/AppConfig.php +++ b/src/Apps/AppConfig.php @@ -1,12 +1,12 @@ new AppConfig() diff --git a/src/Apps/ApplicationInterface.php b/src/Apps/ApplicationInterface.php index 3f762cc..f6aa406 100644 --- a/src/Apps/ApplicationInterface.php +++ b/src/Apps/ApplicationInterface.php @@ -1,16 +1,16 @@ 'App title', * 'parent_app' => 'parent_app_id', // Parent app id or package name * 'description' => 'App description....', - * 'routing' => '\\Dissonance\\App\\Core\\Routing', // class name implements {@see \Dissonance\Routing\AppRoutingInterface} - * 'controllers_namespace' => '\\Dissonance\\App\\Core\\Controllers', // Your base controllers namespace + * 'routing' => '\\Symbiotic\\App\\Core\\Routing', // class name implements {@see \Symbiotic\Routing\AppRoutingInterface} + * 'controllers_namespace' => '\\Symbiotic\\App\\Core\\Controllers', // Your base controllers namespace * 'version' => '1.0.2', * 'providers' => [ // Providers of your app - * '\\Dissonance\\App\\Core\\Providers\\FilesProvider', - * '\\Dissonance\\App\\Core\\Providers\\AppsUpdaterProvider', + * '\\Symbiotic\\App\\Core\\Providers\\FilesProvider', + * '\\Symbiotic\\App\\Core\\Providers\\AppsUpdaterProvider', * ], * * // .... and your advanced params diff --git a/src/Apps/AppsRepositoryInterface.php b/src/Apps/AppsRepositoryInterface.php index 4a43b3b..eaebd0c 100644 --- a/src/Apps/AppsRepositoryInterface.php +++ b/src/Apps/AppsRepositoryInterface.php @@ -1,6 +1,6 @@ add(AppsRoutesRepository::class, function (AppsRoutesRepository $event, AppsRepositoryInterface $appsRepository) { foreach ($appsRepository->enabled() as $v) { diff --git a/src/Container/ArrayAccessTrait.php b/src/Container/ArrayAccessTrait.php index 220336e..2bd3da5 100644 --- a/src/Container/ArrayAccessTrait.php +++ b/src/Container/ArrayAccessTrait.php @@ -1,30 +1,30 @@ getContainerItems(); return $this->hasBy($key,$items) ? $items[$key] : @@ -43,7 +43,7 @@ public function get($key) * @info * @return bool */ - public function has($key): bool + public function has(string|int $key): bool { $items = &$this->getContainerItems(); return $this->hasBy($key,$items); @@ -55,7 +55,7 @@ public function has($key): bool * @return bool * @info */ - private function hasBy($key, &$items): bool + private function hasBy(string|int $key, \ArrayAccess|array &$items): bool { return isset($items[$key]) // isset в 4 раза быстрее array_key_exists || (is_array($items) && array_key_exists($key, $items)) @@ -66,7 +66,7 @@ private function hasBy($key, &$items): bool * @param int|string $key * @param $value */ - public function set($key, $value): void + public function set(string|int $key, $value): void { $items = &$this->getContainerItems(); $items[$key] = $value; @@ -77,7 +77,7 @@ public function set($key, $value): void * @param int|string $key * @return mixed */ - public function delete($key): bool + public function delete(string|int $key): bool { $items = &$this->getContainerItems(); unset($items[$key]); diff --git a/src/Container/BindingResolutionException.php b/src/Container/BindingResolutionException.php index 2acb1e4..18ff237 100644 --- a/src/Container/BindingResolutionException.php +++ b/src/Container/BindingResolutionException.php @@ -1,6 +1,6 @@ $this->container_cache, @@ -106,7 +106,7 @@ protected function getSerializeData(): array public function unserialize($serialized) { /** - * @var \Dissonance\Container\ContainerTrait|\Dissonance\Container\SubContainerTrait| $this + * @var \Symbiotic\Container\ContainerTrait|\Symbiotic\Container\SubContainerTrait| $this */ $data = \unserialize($serialized, ['allowed_classes' => true]); $this->container_cache = $data['cache']; @@ -126,7 +126,7 @@ protected function unserialized(array $data) public function __destruct() { /** - * @var \Dissonance\Container\ContainerTrait|\Dissonance\Container\SubContainerTrait| $this + * @var \Symbiotic\Container\ContainerTrait|\Symbiotic\Container\SubContainerTrait| $this */ if ($this->container_cache) { // $this->container_cache->has($this->container_key); diff --git a/src/Container/Container.php b/src/Container/Container.php index 8a12aec..328df49 100644 --- a/src/Container/Container.php +++ b/src/Container/Container.php @@ -1,6 +1,6 @@ instances[$abstract], $this->aliases[$abstract]); @@ -257,7 +257,7 @@ public function getClosure(string $abstract, string $concrete) return function ($container, $parameters = []) use ($abstract, $concrete) { /** - * @var \Dissonance\Container\DIContainerInterface $container + * @var \Symbiotic\Container\DIContainerInterface $container */ if ($abstract === $concrete) { return $container->build($concrete); @@ -277,7 +277,7 @@ public function getClosure(string $abstract, string $concrete) * @param bool $shared * @return $this */ - public function bindIf(string $abstract, $concrete = null, bool $shared = false) + public function bindIf(string $abstract, Closure|string $concrete = null, bool $shared = false) { if (!$this->bound($abstract)) { $this->bind($abstract, $concrete, $shared); @@ -294,7 +294,7 @@ public function bindIf(string $abstract, $concrete = null, bool $shared = false * @param string|null $alias * @return static */ - public function singleton(string $abstract, $concrete = null, string $alias = null) + public function singleton(string $abstract, Closure|string $concrete = null, string $alias = null) { $this->bind($abstract, $concrete, true); if (is_string($alias)) { @@ -459,7 +459,7 @@ public function wrap(\Closure $callback, array $parameters = [], $defaultMethod * @param string|null $defaultMethod * @return mixed */ - public function call($callback, array $parameters = [], string $defaultMethod = null) + public function call(callable|string $callback, array $parameters = [], string $defaultMethod = null) { return BoundMethod::call($this, $callback, $parameters, $defaultMethod); } @@ -625,7 +625,7 @@ protected function getContextualConcrete(string $for_building, string $need) * @param string $abstract * @return bool */ - protected function isBuildable($concrete, string $abstract) + protected function isBuildable(string|\Closure $concrete, string $abstract) { return $concrete === $abstract || $concrete instanceof \Closure; } @@ -638,7 +638,7 @@ protected function isBuildable($concrete, string $abstract) * * @throws BindingResolutionException|ContainerException */ - public function build($concrete) + public function build(string|Closure $concrete) { // If the concrete type is actually a Closure, we will just execute it and // hand back the results of the functions, which allows functions to be @@ -831,7 +831,7 @@ protected function resolveClass(\ReflectionParameter $parameter) * @param callable|null $callback closure or Invokable object * @return void */ - public function resolving($abstract, callable $callback = null) + public function resolving(string|\Closure $abstract, callable $callback = null) { if (is_string($abstract)) { $abstract = $this->getAlias($abstract); @@ -851,7 +851,7 @@ public function resolving($abstract, callable $callback = null) * @param callable|null $callback closure or Invokable object * @return void */ - public function afterResolving($abstract, callable $callback = null) + public function afterResolving(\Closure|string $abstract, callable $callback = null) { if (is_string($abstract)) { $abstract = $this->getAlias($abstract); diff --git a/src/Container/ContextualBindingBuilder.php b/src/Container/ContextualBindingBuilder.php index 604da32..e938472 100644 --- a/src/Container/ContextualBindingBuilder.php +++ b/src/Container/ContextualBindingBuilder.php @@ -1,15 +1,15 @@ concrete = $concrete; $this->container = $container; diff --git a/src/Container/ContextualBindingsInterface.php b/src/Container/ContextualBindingsInterface.php index 7df2a01..66a150d 100644 --- a/src/Container/ContextualBindingsInterface.php +++ b/src/Container/ContextualBindingsInterface.php @@ -1,6 +1,6 @@ - * @refactor Sergey Surkov + * @refactor Sergey Surkov */ interface FactoryInterface { diff --git a/src/Container/ItemsContainerTrait.php b/src/Container/ItemsContainerTrait.php index d3c6463..55fb055 100644 --- a/src/Container/ItemsContainerTrait.php +++ b/src/Container/ItemsContainerTrait.php @@ -1,6 +1,6 @@ items; return $this->hasBy($key,$items) ? $items[$key] : @@ -38,7 +38,7 @@ public function get($key) * @info * @return bool */ - public function has($key): bool + public function has(string|int $key): bool { return $this->hasBy($key,$this->items); } @@ -49,7 +49,7 @@ public function has($key): bool * @return bool * @info */ - private function hasBy($key, &$items): bool + private function hasBy(string|int $key, array &$items): bool { return isset($items[$key]) // isset в 4 раза быстрее array_key_exists || (is_array($items) && array_key_exists($key, $items)) @@ -60,7 +60,7 @@ private function hasBy($key, &$items): bool * @param int|string $key * @param $value */ - public function set($key, $value): void + public function set(string|int $key, $value): void { $this->items[$key] = $value; } @@ -70,7 +70,7 @@ public function set($key, $value): void * @param int|string $key * @return bool */ - public function delete($key): bool + public function delete(string|int $key): bool { unset($this->items[$key]); diff --git a/src/Container/MagicAccessInterface.php b/src/Container/MagicAccessInterface.php index e1e34ac..523b9e2 100644 --- a/src/Container/MagicAccessInterface.php +++ b/src/Container/MagicAccessInterface.php @@ -1,12 +1,12 @@ bindParameters($parameters), $defaultMethod); } @@ -122,7 +122,7 @@ protected function rebound($abstract) * @param bool $shared * @return void */ - public function bind(string $abstract, $concrete = null, bool $shared = false): void + public function bind(string $abstract, Closure|string $concrete = null, bool $shared = false): void { unset($this->instances[$abstract], $this->aliases[$abstract]); if (!$concrete) { @@ -205,19 +205,19 @@ public function resolve(string $abstract, array $parameters = [], bool $raiseEve return $this->app->resolve($alias, $this->bindParameters($parameters), $raiseEvents); } - public function build($concrete) + public function build(string|Closure $concrete) { return $this->app->build($concrete); } - public function bindIf(string $abstract, $concrete = null, bool $shared = false) + public function bindIf(string $abstract, Closure|string $concrete = null, bool $shared = false) { if (!$this->bound($abstract)) { $this->bind($abstract, $concrete, $shared); } } - public function singleton(string $abstract, $concrete = null, string $alias = null) + public function singleton(string $abstract, Closure|string $concrete = null, string $alias = null) { $this->bind($abstract, $concrete, true); if (is_string($alias)) { @@ -334,7 +334,7 @@ public function addContextualBinding(string $concrete, string $abstract, $implem $this->app->addContextualBinding($concrete, $abstract, $implementation); } - public function when($concrete): ContextualBindingBuilder + public function when(string|array $concrete): ContextualBindingBuilder { return $this->app->when($concrete); } diff --git a/src/Core/AbstractBootstrap.php b/src/Core/AbstractBootstrap.php index e74d591..77d265b 100644 --- a/src/Core/AbstractBootstrap.php +++ b/src/Core/AbstractBootstrap.php @@ -1,13 +1,13 @@ cached($abstract, $concrete, $alias) diff --git a/src/Core/Autoloader.php b/src/Core/Autoloader.php index 7e9e767..f195228 100644 --- a/src/Core/Autoloader.php +++ b/src/Core/Autoloader.php @@ -1,17 +1,17 @@ new \Dissonance\Config(), - * 'events' => new \Dissonance\Contracts\Events\Dispatcher(), //{@see \Dissonance\Core\Bootstrap\EventBootstrap::bootstrap()} - * 'listeners' => new \Dissonance\Events\ListenerProvider(), //{@see \Dissonance\Core\Bootstrap\EventBootstrap::bootstrap()} + * 'config' => new \Symbiotic\Config(), + * 'events' => new \Symbiotic\Contracts\Events\Dispatcher(), //{@see \Symbiotic\Core\Bootstrap\EventBootstrap::bootstrap()} + * 'listeners' => new \Symbiotic\Events\ListenerProvider(), //{@see \Symbiotic\Core\Bootstrap\EventBootstrap::bootstrap()} * * // Сервисы которых может еще не быть, но они доступны сразу после отработки всех бутстраперов * - * 'apps' => new \Dissonance\Contracts\Appss\AppsRepository(), //{@see \Dissonance\Apps\Bootstrap::bootstrap()} - * 'cache' => new \Dissonance\SimpleCacheFilesystem\Cache(), // может и не быть пакета - * 'resources' => new \Dissonance\Packages\Resources(), //{@see \Dissonance\Packages\ResourcesBootstrap::bootstrap()} - * 'http_factory' => new \Dissonance\Http\PsrHttpFactory(), //{@see \Dissonance\Http\Bootstrap::bootstrap()} + * 'apps' => new \Symbiotic\Contracts\Appss\AppsRepository(), //{@see \Symbiotic\Apps\Bootstrap::bootstrap()} + * 'cache' => new \Symbiotic\SimpleCacheFilesystem\Cache(), // может и не быть пакета + * 'resources' => new \Symbiotic\Packages\Resources(), //{@see \Symbiotic\Packages\ResourcesBootstrap::bootstrap()} + * 'http_factory' => new \Symbiotic\Http\PsrHttpFactory(), //{@see \Symbiotic\Http\Bootstrap::bootstrap()} * * // Сервисы из провайдеров, доступны после бутстрапа ядра {@see HttpRunner::run(), HttpKernel::bootstrap()} * // Http сервисы - * 'router' => new \Dissonance\Contracts\Routing\Router(), //{@see \Dissonance\Routing\Provider::registerRouter()} - * 'request' => new \Dissonance\Http\ServerRequest(), //{@see \Dissonance\Http\Bootstrap::bootstrap()} - * 'cookie' => new \Dissonance\Http\Cookie\CookiesInterface(), + * 'router' => new \Symbiotic\Contracts\Routing\Router(), //{@see \Symbiotic\Routing\Provider::registerRouter()} + * 'request' => new \Symbiotic\Http\ServerRequest(), //{@see \Symbiotic\Http\Bootstrap::bootstrap()} + * 'cookie' => new \Symbiotic\Http\Cookie\CookiesInterface(), * // Доступен только при обработке в контроллерах - * 'route' => new \Dissonance\Http\ServerRequest(), //{@see \Dissonance\Http\Bootstrap::bootstrap()} + * 'route' => new \Symbiotic\Http\ServerRequest(), //{@see \Symbiotic\Http\Bootstrap::bootstrap()} * ] */ public function bootstrap(CoreInterface $app) : void; diff --git a/src/Core/CachedCore.php b/src/Core/CachedCore.php index 47b1903..bf37151 100644 --- a/src/Core/CachedCore.php +++ b/src/Core/CachedCore.php @@ -1,8 +1,8 @@ bootstraps[] = $v; diff --git a/src/Core/CoreInterface.php b/src/Core/CoreInterface.php index c8c17f7..930ab0f 100644 --- a/src/Core/CoreInterface.php +++ b/src/Core/CoreInterface.php @@ -1,12 +1,12 @@ bool (active flag),... ] */ - protected $providers = []; + protected array $providers = []; /** * @var array [serviceClassName => ProviderClassName] */ - protected $defer_services = []; + protected array $defer_services = []; - protected $loaded = false; + protected bool $loaded = false; /** * @param string|string[] $items diff --git a/src/Core/Runner.php b/src/Core/Runner.php index d9b77d2..f0ba34b 100644 --- a/src/Core/Runner.php +++ b/src/Core/Runner.php @@ -1,6 +1,6 @@ new \Dissonance\Config(), {@used-by \_DS\config()} - * 'events' => new \Dissonance\Event\EventDispatcher(), //{@see \Dissonance\Core\Bootstrap\EventBootstrap::bootstrap()} - * 'listeners' => new \Dissonance\Events\ListenerProvider(), //{@see \Dissonance\Core\Bootstrap\EventBootstrap::bootstrap()} + * 'config' => new \Symbiotic\Config(), {@used-by \_DS\config()} + * 'events' => new \Symbiotic\Event\EventDispatcher(), //{@see \Symbiotic\Core\Bootstrap\EventBootstrap::bootstrap()} + * 'listeners' => new \Symbiotic\Events\ListenerProvider(), //{@see \Symbiotic\Core\Bootstrap\EventBootstrap::bootstrap()} * * // Сервисы которых может еще не быть, но они доступны сразу после отработки всех бутстраперов * - * 'apps' => new \Dissonance\Appss\AppsRepository(), //{@see \Dissonance\Apps\Bootstrap::bootstrap()} - * 'cache' => new \Dissonance\SimpleCache\Cache(), // может и не быть пакета - * 'resources' => new \Dissonance\Packages\Resources(), //{@see \Dissonance\Packages\ResourcesBootstrap::bootstrap()} - * 'http_factory' => new \Dissonance\Http\PsrHttpFactory(), //{@see \Dissonance\Http\Bootstrap::bootstrap()} + * 'apps' => new \Symbiotic\Appss\AppsRepository(), //{@see \Symbiotic\Apps\Bootstrap::bootstrap()} + * 'cache' => new \Symbiotic\SimpleCache\Cache(), // может и не быть пакета + * 'resources' => new \Symbiotic\Packages\Resources(), //{@see \Symbiotic\Packages\ResourcesBootstrap::bootstrap()} + * 'http_factory' => new \Symbiotic\Http\PsrHttpFactory(), //{@see \Symbiotic\Http\Bootstrap::bootstrap()} * * // Сервисы из провайдеров, доступны после бутстрапа ядра {@see HttpRunner::run(), HttpKernel::bootstrap()} * * // HTTP сервисы, используются в {@see HttpKernel::handle(), RoutingHandler::handle()} - * 'router' => new \Dissonance\Routing\Router(), //{@see \Dissonance\Routing\Provider::registerRouter()} - * 'request' => new \Dissonance\Http\ServerRequest(), //{@see HttpKernel::handle()} - * 'session' => new \Dissonance\Session\SessionStorageInterface(), //{@see \Dissonance\Session\SessionStorageNative} - * 'cookie' => new \Dissonance\Http\Cookie\CookiesInterface(), //{@see \Dissonance\Http\Cookie\CookiesProvider::register()} + * 'router' => new \Symbiotic\Routing\Router(), //{@see \Symbiotic\Routing\Provider::registerRouter()} + * 'request' => new \Symbiotic\Http\ServerRequest(), //{@see HttpKernel::handle()} + * 'session' => new \Symbiotic\Session\SessionStorageInterface(), //{@see \Symbiotic\Session\SessionStorageNative} + * 'cookie' => new \Symbiotic\Http\Cookie\CookiesInterface(), //{@see \Symbiotic\Http\Cookie\CookiesProvider::register()} * // Доступен только при обработке в контроллерах!!! - * 'route' => new \Dissonance\Routing\RouteInterface(), //{@see \Dissonance\Http\Kernel\RouteHandler::handle()} + * 'route' => new \Symbiotic\Routing\RouteInterface(), //{@see \Symbiotic\Http\Kernel\RouteHandler::handle()} * ] */ abstract class Runner implements RunnerInterface diff --git a/src/Core/RunnerInterface.php b/src/Core/RunnerInterface.php index bfa78cc..f931301 100644 --- a/src/Core/RunnerInterface.php +++ b/src/Core/RunnerInterface.php @@ -1,6 +1,6 @@ new \Dissonance\Config(), - * 'router' => new \Dissonance\Contracts\Routing\Router(), - * 'apps' => new \Dissonance\Contracts\Appss\AppsRepository(), - * 'events' => new \Dissonance\Contracts\Events\Dispatcher(), - * 'listeners' => new \Dissonance\Event\ListenerProvider() + * 'config' => new \Symbiotic\Config(), + * 'router' => new \Symbiotic\Contracts\Routing\Router(), + * 'apps' => new \Symbiotic\Contracts\Appss\AppsRepository(), + * 'events' => new \Symbiotic\Contracts\Events\Dispatcher(), + * 'listeners' => new \Symbiotic\Event\ListenerProvider() * ] */ class ServiceProvider implements ServiceProviderInterface { /** - * @var DIContainerInterface| [ 'config' => new \Dissonance\Config() ] + * @var DIContainerInterface| [ 'config' => new \Symbiotic\Config() ] */ protected $app = null; diff --git a/src/Core/ServiceProviderInterface.php b/src/Core/ServiceProviderInterface.php index 5ba7096..dc48e8a 100644 --- a/src/Core/ServiceProviderInterface.php +++ b/src/Core/ServiceProviderInterface.php @@ -1,13 +1,13 @@ new \Dissonance\Config(), - * 'router' => new \Dissonance\Contracts\Routing\Router(), - * 'apps' => new \Dissonance\Contracts\Appss\AppsRepository(), + * 'config' => new \Symbiotic\Config(), + * 'router' => new \Symbiotic\Contracts\Routing\Router(), + * 'apps' => new \Symbiotic\Contracts\Appss\AppsRepository(), * * * diff --git a/src/Core/Support/Arr.php b/src/Core/Support/Arr.php index d07f4e0..2800436 100644 --- a/src/Core/Support/Arr.php +++ b/src/Core/Support/Arr.php @@ -1,6 +1,6 @@ Dissonance php'); + * Section::start('header', 'Symbiotic php'); * * * @param string $section diff --git a/src/Core/View/View.php b/src/Core/View/View.php index fbf756a..1836526 100644 --- a/src/Core/View/View.php +++ b/src/Core/View/View.php @@ -1,18 +1,18 @@ new \Dissonance\Config(), - * 'router' => new \Dissonance\Contracts\Routing\Router(), - * 'apps' => new \Dissonance\Contracts\Apps\AppsRepository() + * 'config' => new \Symbiotic\Config(), + * 'router' => new \Symbiotic\Contracts\Routing\Router(), + * 'apps' => new \Symbiotic\Contracts\Apps\AppsRepository() * * ] * @used-by View::setContainer() @@ -363,6 +363,7 @@ public function layout(string $template, $content_template, $vars = [], $before return $view; } + /** * @param CoreInterface $app * @uses View::$core diff --git a/src/Event/DispatcherInterface.php b/src/Event/DispatcherInterface.php index b9f3fb4..ff78bb9 100644 --- a/src/Event/DispatcherInterface.php +++ b/src/Event/DispatcherInterface.php @@ -1,6 +1,6 @@ listeners[$event][] = $handler; } diff --git a/src/Event/ListenersInterface.php b/src/Event/ListenersInterface.php index 13ee13c..7674adb 100644 --- a/src/Event/ListenersInterface.php +++ b/src/Event/ListenersInterface.php @@ -1,6 +1,6 @@ ['name' =>'c_name','value' => 'val','domain' =>'domain.com','path' => '/',..], diff --git a/src/Http/Cookie/CookiesMiddleware.php b/src/Http/Cookie/CookiesMiddleware.php index 41b2033..a6a14eb 100644 --- a/src/Http/Cookie/CookiesMiddleware.php +++ b/src/Http/Cookie/CookiesMiddleware.php @@ -1,6 +1,6 @@ app; - $symbiosis = \_DS\config('symbiosis',false); + $symbiotic = \_DS\config('symbiotic',false); try { $request_interface = ServerRequestInterface::class; $request = $app[PsrHttpFactory::class]->createServerRequestFromGlobals(); @@ -57,10 +57,10 @@ public function run(): void $response = $handler->handle($request); // Определяем нужно ли отдавать ответ - if (!$app('destroy_response', false) || !$symbiosis) { + if (!$app('destroy_response', false) || !$symbiotic) { $this->sendResponse($response); // при режиме симбиоза не даем другим скриптам продолжить работу, т.к. отдали наш ответ - if ($symbiosis) { + if ($symbiotic) { exit;// завершаем работу } } else { @@ -69,7 +69,7 @@ public function run(): void } catch (\Throwable $e) { // при режиме симбиоза не отдаем ответ с ошибкой, запишем выше в лог - if (!$symbiosis) { + if (!$symbiotic) { $this->sendResponse($app[HttpKernelInterface::class]->response(500, $e)); } else { // TODO:log @@ -132,7 +132,7 @@ public function sendResponse(ResponseInterface $response) $sender = new ResponseSender($response); $sender->render(); if (\function_exists('fastcgi_finish_request')) { - \fastcgi_finish_request(); + fastcgi_finish_request(); } elseif (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) { static::closeOutputBuffers(0, true); } diff --git a/src/Http/Kernel/PreloadKernelHandler.php b/src/Http/Kernel/PreloadKernelHandler.php index 5878f88..1db2232 100644 --- a/src/Http/Kernel/PreloadKernelHandler.php +++ b/src/Http/Kernel/PreloadKernelHandler.php @@ -1,8 +1,8 @@ app; /** - * @var \Dissonance\Routing\RouteInterface|null $route + * @var \Symbiotic\Routing\RouteInterface|null $route */ $path = $request->getUri()->getPath(); $route = $app['router']->match($request->getMethod(), $path); diff --git a/src/Http/Middleware/MiddlewareCallback.php b/src/Http/Middleware/MiddlewareCallback.php index ca1a280..f8bd338 100644 --- a/src/Http/Middleware/MiddlewareCallback.php +++ b/src/Http/Middleware/MiddlewareCallback.php @@ -1,6 +1,6 @@ T . 'plain', 'htm' => T . 'html', diff --git a/src/Packages/AssetFileMiddleware.php b/src/Packages/AssetFileMiddleware.php index f35b7e9..70c7771 100644 --- a/src/Packages/AssetFileMiddleware.php +++ b/src/Packages/AssetFileMiddleware.php @@ -1,8 +1,8 @@ getRequestTarget(), '/'), $match)) { /** - * @var \Dissonance\Http\PsrHttpFactory|ResponseFactoryInterface $response_factory + * @var \Symbiotic\Http\PsrHttpFactory|ResponseFactoryInterface $response_factory */ $response_factory = $this->response_factory; try { diff --git a/src/Packages/AssetsRepositoryInterface.php b/src/Packages/AssetsRepositoryInterface.php index e0b2243..0e76fbd 100644 --- a/src/Packages/AssetsRepositoryInterface.php +++ b/src/Packages/AssetsRepositoryInterface.php @@ -1,12 +1,12 @@ new \Dissonance\Config(), - * 'router' => new \Dissonance\Contracts\Routing\Router(), - * 'apps' => new \Dissonance\Contracts\Appss\AppsRepository(), - * 'events' => new \Dissonance\Event\DispatcherInterface(), - * 'listeners' => new \Dissonance\Event\ListenersInterface(), + * 'config' => new \Symbiotic\Config(), + * 'router' => new \Symbiotic\Contracts\Routing\Router(), + * 'apps' => new \Symbiotic\Contracts\Appss\AppsRepository(), + * 'events' => new \Symbiotic\Event\DispatcherInterface(), + * 'listeners' => new \Symbiotic\Event\ListenersInterface(), * ] */ class PackagesRepository implements PackagesRepositoryInterface @@ -23,7 +23,7 @@ class PackagesRepository implements PackagesRepositoryInterface */ protected $loaders = []; - protected $items = []; + protected array $items = []; protected $loaded = false; diff --git a/src/Packages/PackagesRepositoryInterface.php b/src/Packages/PackagesRepositoryInterface.php index 819020e..ad657a0 100644 --- a/src/Packages/PackagesRepositoryInterface.php +++ b/src/Packages/PackagesRepositoryInterface.php @@ -1,6 +1,6 @@ 'module.entity.edit', * 'module' => 'module_name', - * 'middleware' => ['\\Dissonance\\Http\\Middlewares\Auth', '\\Module\\Http\\Middlewares\Test'] + * 'middleware' => ['\\Symbiotic\\Http\\Middlewares\Auth', '\\Module\\Http\\Middlewares\Test'] * ] * * @return Route diff --git a/src/Routing/RouterCacheFactory.php b/src/Routing/RouterCacheFactory.php index 940d8da..d4fa26b 100644 --- a/src/Routing/RouterCacheFactory.php +++ b/src/Routing/RouterCacheFactory.php @@ -1,8 +1,8 @@ 'module.entity.edit', * 'module' => 'prefix_module', - * 'middleware' => ['\\Dissonance\\Http\\Middlewares\Auth', '\\Module\\Http\\Middlewares\Test'] + * 'middleware' => ['\\Symbiotic\\Http\\Middlewares\Auth', '\\Module\\Http\\Middlewares\Test'] * ] * * @return RouteInterface diff --git a/src/Routing/RouterLazy.php b/src/Routing/RouterLazy.php index 31c1634..16b295b 100644 --- a/src/Routing/RouterLazy.php +++ b/src/Routing/RouterLazy.php @@ -1,11 +1,11 @@ add(CacheClear::class, function($event) use ($app){ $app[CacheInterface::class]->clear(); }); - $app->alias(CacheInterface::class,\Dissonance\SimpleCacheFilesystem\SimpleCacheInterface::class); + $app->alias(CacheInterface::class,\Symbiotic\SimpleCacheFilesystem\SimpleCacheInterface::class); } } } diff --git a/src/SimpleCacheFilesystem/Exception.php b/src/SimpleCacheFilesystem/Exception.php index e718a45..4d350e2 100644 --- a/src/SimpleCacheFilesystem/Exception.php +++ b/src/SimpleCacheFilesystem/Exception.php @@ -1,13 +1,13 @@ matcher('include'); - return preg_replace($pattern, '$1with(get_defined_vars())->render(); ?>', $value); + return preg_replace($pattern, '$1with(get_defined_vars())->render(); ?>', $value); } /** diff --git a/src/View/Blade/Bootstrap.php b/src/View/Blade/Bootstrap.php index e650091..3bfcbc3 100644 --- a/src/View/Blade/Bootstrap.php +++ b/src/View/Blade/Bootstrap.php @@ -1,12 +1,12 @@ true, - 'symbiosis' => false, // Режим симбиоза, если включен и фреймворк не найдет обработчик, + 'symbiotic' => false, // Режим симбиоза, если включен и фреймворк не найдет обработчик, // то он ничего не вернет и основной фреймворк смодет сам обработать запрос 'default_host' => 'localhost',// для консоли , но ее пока нет - 'uri_prefix' => 'dissonance', // Префикс в котором работет фреймворк, если пустой то работае от корня + 'uri_prefix' => 'symbiotic', // Префикс в котором работет фреймворк, если пустой то работае от корня 'base_path' => $basePath, // базовая папка проекта 'assets_prefix' => '/assets', 'storage_path' => $basePath . '/storage', // Если убрать то кеш отключится @@ -13,24 +13,24 @@ $basePath . '/vendor', // Папка для приложений ], 'bootstrappers' => [ - \Dissonance\Develop\Bootstrap\DebugBootstrap::class,/// debug only - \Dissonance\Core\Bootstrap\EventBootstrap::class, - \Dissonance\SimpleCacheFilesystem\Bootstrap::class, - \Dissonance\Packages\PackagesLoaderFilesystemBootstrap::class, - \Dissonance\Packages\PackagesBootstrap::class, - \Dissonance\Packages\ResourcesBootstrap::class, - \Dissonance\Apps\Bootstrap::class, - \Dissonance\Http\Bootstrap::class, - \Dissonance\Http\Kernel\Bootstrap::class, - \Dissonance\View\Blade\Bootstrap::class, + \Symbiotic\Develop\Bootstrap\DebugBootstrap::class,/// debug only + \Symbiotic\Core\Bootstrap\EventBootstrap::class, + \Symbiotic\SimpleCacheFilesystem\Bootstrap::class, + \Symbiotic\Packages\PackagesLoaderFilesystemBootstrap::class, + \Symbiotic\Packages\PackagesBootstrap::class, + \Symbiotic\Packages\ResourcesBootstrap::class, + \Symbiotic\Apps\Bootstrap::class, + \Symbiotic\Http\Bootstrap::class, + \Symbiotic\Http\Kernel\Bootstrap::class, + \Symbiotic\View\Blade\Bootstrap::class, ], 'providers' => [ - \Dissonance\Http\Cookie\CookiesProvider::class, - \Dissonance\Routing\SettlementsRoutingProvider::class, - \Dissonance\Routing\CacheRoutingProvider::class, - \Dissonance\Session\NativeProvider::class, + \Symbiotic\Http\Cookie\CookiesProvider::class, + \Symbiotic\Routing\SettlementsRoutingProvider::class, + \Symbiotic\Routing\CacheRoutingProvider::class, + \Symbiotic\Session\NativeProvider::class, ], 'providers_exclude' => [ - \Dissonance\Routing\Provider::class, + \Symbiotic\Routing\Provider::class, ], ]; \ No newline at end of file diff --git a/src/core_helpers.php b/src/core_helpers.php index d505391..c23878e 100644 --- a/src/core_helpers.php +++ b/src/core_helpers.php @@ -2,11 +2,11 @@ namespace _DS; -use Dissonance\Core\Config; -use Dissonance\Core\Core; -use \Dissonance\Core\Support\Str; -use \Dissonance\Core\Support\Collection; -use \Dissonance\Core\Support\Arr; +use Symbiotic\Core\Config; +use Symbiotic\Core\Core; +use \Symbiotic\Core\Support\Str; +use \Symbiotic\Core\Support\Collection; +use \Symbiotic\Core\Support\Arr; const DS = DIRECTORY_SEPARATOR; @@ -240,8 +240,8 @@ function data_set(&$target, $key, $value, $overwrite = true) * @param string $haystack * @param string|array $needles * @return bool - * @uses \Dissonance\Core\Support\Str::endsWith() - * @deprecated \Dissonance\Str::endsWith() should be used directly instead. Will be removed in Laravel 5.9. + * @uses \Symbiotic\Core\Support\Str::endsWith() + * @deprecated \Symbiotic\Str::endsWith() should be used directly instead. Will be removed in Laravel 5.9. */ function ends_with($haystack, $needles) { diff --git a/src/dissonance.php b/src/dissonance.php index 9305bfa..86cc2c3 100644 --- a/src/dissonance.php +++ b/src/dissonance.php @@ -1,7 +1,7 @@ buildCore($config); /// Запускаем @@ -24,6 +24,6 @@ /** * Дальше может идти запуск вашего фреймворка - * при режиме симбиоза Dissonance обрабаытвает только свои роуты + * при режиме симбиоза Symbiotic обрабаытвает только свои роуты */ diff --git a/src/http_kernel_helpers.php b/src/http_kernel_helpers.php index cc198d3..495d199 100644 --- a/src/http_kernel_helpers.php +++ b/src/http_kernel_helpers.php @@ -3,7 +3,7 @@ namespace _DS; -use Dissonance\Core\HttpKernelInterface; +use Symbiotic\Core\HttpKernelInterface; use Psr\Http\Message\ResponseFactoryInterface; use Psr\Http\Message\ResponseInterface;