brickfox / ext-application
将Sencha Ext JS集成到PHP应用程序的基础组件
Requires
- php: >=5.3.9
Requires (Dev)
- phpunit/phpunit: ~4.8,!=4.8.20|~5.1
This package is not auto-updated.
Last update: 2024-09-21 15:53:30 UTC
README
将Sencha Ext JS集成到PHP应用程序的基础组件
介绍
此库提供了围绕从开发环境和生产环境使用服务器生成页面运行Sencha Ext JS 6(尽管5也应该可以)应用程序的不同要求的简单抽象。开发和生产构建使用不同的源树来提供服务应用程序文件。此过程基于所谓的清单和JavaScript微加载器。为了确保此过程与服务器生成页面和路由无缝工作,库会钩入清单生成并基于所需的环境和上下文动态修改清单。
目前,此库仅作为teqneers/ext-application-bundle的基础,这是一个将Ext JS集成到基于Symfony 2的应用程序中的Symfony 2捆绑包。我们没有尝试将库作为独立组件或在Symfony 2环境之外的其他任何环境中使用,因此以下内容仅是理论上如何在不使用捆绑包的情况下工作。我们非常欢迎任何帮助和贡献,以使库在捆绑包之外更有用。
安装
您可以使用composer安装此库
composer require teqneers/ext-application
或将包直接添加到您的composer.json文件中。
示例
给定以下虚构应用程序的目录结构
./
|-- src/ Application source code
|-- htdocs/ Public web-facing directory (document root)
| |-- index.php PHP front controller
| |-- app/ Root folder for Ext JS application production build
|-- my-app/ The Ext JS application source folder (sencha generate app -ext MyApp ./my-app)
您应该配置您的应用程序(例如,从index.php)
$config = \TQ\ExtJS\Application\Configuration\ApplicationConfiguration( __DIR__ . '/../my-app', // the absolute path to the Ext JS application workspace '../my-app', // the relative path from the public web-facing directory to the Ext JS application workspace __DIR__, // the absolute path to the public web-facing directory '/' // the relative path from the public web-facing directory to the root directory used for production build artifacts (usually /) ); // add a default build $config->addBuild( 'default', // the build name (just for referencing the build) '/', // the application path relative to the Ext JS application workspace (usually / unless you have multiple applications and/or packages in a single workspace) 'app', // the application path relative to the root directory used for production build artifacts 'manifest.json', // the build manifest filename for development builds 'bootstrap.js', // the micro-loader filename for development builds null, // the application cache manifest filename for development builds (usually NULL) 'bootstrap.json', // the build manifest filename for production builds 'bootstrap.js', // the micro-loader filename for production builds 'cache.appcache' // the application cache manifest filename fro production builds ); $application = new \TQ\ExtJS\Application\Application( $config, new \TQ\ExtJS\Application\Manifest\ManifestLoader(), 'dev' // dev or prod depending on wether you want to run from development or drom production build ); $microLoader = $application->getMicroLoaderFile(); // returns a \SplFileInfo for the configured micro-loader $hasAppCache = $application->hasAppCache(); if ($hasAppCache) { $appCache = $application->getAppCacheFile(); // returns a \SplFileInfo for the configured application cache manifest } $manifest = $application->getManifest('/htdocs'); // returns a \TQ\ExtJS\Application\Manifest\Manifest configured correctly when running document root on your application base path echo $manifest; // outputs the manifest
在开发模式下运行应用程序时,您必须确保您的Web服务器的文档根位于(常规)面向Web的公开目录的上一级,以便Web服务器可以同时服务Ext JS应用程序工作区的文件。
许可证
MIT许可证(MIT)
版权所有 © 2015 TEQneers GmbH & Co. KG
在此特此免费许可,任何人都可以无限制地处理本软件及其相关文档文件(“软件”),包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售软件副本,并允许向软件提供的人进行此类处理,但受以下条件约束
上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。
软件按“原样”提供,不提供任何形式的保证,无论是明示的、暗示的,还是针对特定目的或侵权。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他责任负责,无论是基于合同、侵权或其他方式,源于、因或与软件或软件的使用或其他方式相关。