full
1.0.0
readme.ru.mdn。
composer require symbiotic/full
对于无PHP优化托管的更快工作,请在一个文件共生/全单位上构建
创建该框架是为了简化独立的小应用程序集成到其他CMS和框架中,并扩展了作曲家软件包的功能。
意识形态是与其他框架合作的小型应用程序的单独生态系统,并方便地集成了其他功能。
有许多软件包和单独编写的应用程序提供有用的功能,具有自己的业务逻辑,有时甚至具有自己的单独的Web界面。
在laravel套件中,以symfony捆绑包,各种插件和附加组件形式的各种CMS,都有自己的路由,事件,缓存等的实现。为Laravel编写的软件包以集成另一个框架或CMS在某些情况下是有问题的,并且在某些情况下,由于某些依赖性是不可能的。
应用程序开发人员本身必须为每个框架和CMS编写改编,这会引起很多问题,并且不涵盖所有生态系统。
此外,此类应用程序必须在系统中进行各种集成:
此类应用程序包括:
该框架已被优化,可与大量应用一起使用,并作为主框架的子系统工作。
每个应用程序都是一个作曲家软件包,直接在Composer.json文件中具有附加说明。
// If you are already using the framework, then you need to enable the symbiosis mode in the config
// In this mode of operation, the framework will respond only to requests related to it and will not block work for "other" requests.
$ config [ ' symbiosis ' ] = true ;该框架直接从作曲家附加到您的index.php。
$ basePath = dirname ( __DIR__ ); // root folder of the project
include_once $ basePath . ' /vendor/autoload.php ' ;
include $ basePath . ' /vendor/symbiotic/full/src/symbiotic.php ' ;
// Then the initialization code and the work of another framework can go on when the symbiosis mode is enabled...
//.... $laravel->handle();
$ basePath = dirname ( __DIR__ ); // root folder of the project
include_once $ basePath . ' /vendor/autoload.php ' ;
$ config = include $ basePath . ' /vendor/symbiotic/full/src/config.sample.php ' ;
//.. Redefining the configuration array
// Basic construction of the Core container
$ core = new Symbiotic Core Core ( $ config );
/**
* When installing the symbiotic/full package, a cached container is available
* Initialization in this case occurs through the Builder:
*/
$ cache = new Symbiotic Cache FilesystemCache ( $ config [ ' storage_path ' ] . ' /cache/core ' );
$ core = ( new Symbiotic Core ContainerBuilder ( $ cache ))
-> buildCore ( $ config );
// Starting request processing
$ core -> run ();
// Then the initialization code and the work of another framework can go on when the symbiosis mode is enabled...
// $laravel->handle(); composer.json文件中申请说明的最小方案:
{
"name" : " vendor/package " ,
"require" : {
// ...
},
"autoload" : {
// ...
},
"extra" : {
"symbiotic" : {
"app" : {
// Application ID
"id" : " my_package_id " ,
// Routing provider
"routing" : " \ MyVendor \ MySuperPackage \ Routing " ,
// Basic namespace for application controllers
"controllers_namespace" : " \ MyVendor \ MySuperPackage \ Http \ Controllers "
}
}
}
}
{
"name" : " vendor/package " ,
"require" : {
// ...
},
"autoload" : {
// ...
},
// Adding a description of the package for the symbiotic
"extra" : {
"symbiotic" : {
// Package ID
"id" : " my_super_package " ,
// Application description, the package may not have an application section
"app" : {
// Application ID, specified without the prefix of the parent application
"id" : " image_optimizer " ,
// ID of the parent application (optional)
"parent_app" : " media " ,
// Application name, used in the application list and menu
"name" : " Media images optimizer " ,
// Routing class (optional)
"routing" : " \ MyVendor \ MySuperPackage \ Routing " ,
// Basic namespace for controllers (optional)
"controllers_namespace" : " \ Symbiotic \ Develop \ Controllers " ,
// Application providers (optional)
"providers" : [
" MyVendor \ MySuperPackage \ Providers \ AppProvider "
],
// Application container class (optional)
// Heir from \Symbiotic\App\Application
"app_class" : " MyVendor \ MySuperPackage \ MyAppContainer "
},
// Folder with static relative to the package root (will be accessible via the web) (optional)
"public_path" : " assets " ,
// Folder with templates and other resources (not accessible via the Web) (optional)
"resources_path" : " my_resources " ,
// Framework Core Extensions
// Bootstrappers (optional)
"bootstrappers" : [
" MyVendor \ MySuperPackage \ CoreBootstrap "
],
// Providers (optional)
"providers" : [
" MyVendor \ MySuperPackage \ MyDbProvider "
],
// Exclusion of kernel providers (optional)
"providers_exclude" : [
// Exclusion of providers from downloading
// For example, with two packages of the same library, it allows you to exclude unnecessary
],
// Event subscribers (optional)
"events" : {
"handlers" : {
"Symbiotic \ Form \ FormBuilder" : " MyVendor \ MyApp \ Events \ FilesystemFieldHandler " ,
"Symbiotic \ Settings \ FieldTypesRepository" : " MyVendor \ MyApp \ Events \ FieldsHandler " ,
"Symbiotic \ UIBackend \ Events \ MainSidebar" : " MyVendor \ MyApp \ Events \ Menu "
}
},
//Package settings fields (optional)
"settings_fields" : [
{
"title" : " Fields group 1 " ,
"name" : " group_1 " ,
"collapsed" : 0 ,
"type" : " group " ,
"fields" : [
{
"label" : " Field 1 " ,
"name" : " filed_name_1 " ,
"type" : " text "
},
{
"label" : " Select 1 " ,
"name" : " select_1 " ,
"type" : " select " ,
"variants" : {
"value1" : " title1 " ,
"value12" : " title2 "
}
},
{
"label" : " Boolean checkbox " ,
"name" : " debug " ,
"description" : " Debug mode " ,
"type" : " boolean "
}
]
}
],
// Default settings (optional)
"settings" : {
"filed_name_1" : " demo_value " ,
"select_1" : " value12 " ,
"debug" : " 0 "
},
// Console commands (optional)
"commands" : {
"worker" : " MyVendor \ MyApp \ Commands \ Worker " ,
"stop" : " MyVendor \ MyApp \ Commands \ Stop "
}
}
}
}
配置应用程序时,您无法为静态和资源指定路径,然后将定义默认路径。
模板应始终在资源文件夹中的/view/目录中!
该框架的所有软件包都可以分为几个逻辑类别:
任何包装都可以结合上述所有内容。
没有明确的强制性结构,您可以使用任何一个。如果您是根据Composer软件包(库)制作的应用程序,以避免混淆,建议将应用程序的所有代码放在src/Symbiotic文件夹中。
vendor/
-/my_vendor
-/my_package_name
-/assets - Public files
-/js
-/css
-/...
-/resources - Resources
-/views - View templates
-/...
-/src - php code
-/Http
-/Cоntrollers
-/...
-/Services
...
-/Routing.php
-/composer.json