timonf/twigony-framework-bundle
Composer 安装命令:
composer require timonf/twigony-framework-bundle
包简介
Twigony FrameworkBundle
README 文档
README
Twigony is inspired by Symfony's TemplateController.
Twigony provides default controller actions for common use cases. You are able to configure Twigony through your
routing.yml file (like Symfony's TemplateController).
Goals of Twigony:
- Easy to use (no own controllers are needed, an Entity and a template is all you need)
- Usable for fast prototyping
- Usable for simple pages
- Much more frontend code (Twig) and less backend code (PHP/Symfony)
- Covers common use cases (database listing, email…)
Information: This project is in development. If you want to support me or this project contact me on Slack (My name: @timon). If you don't have access to Slack, have a look here.
Installation
Create an empty project and use composer to install this bundle:
$ symfony new your-new-project $ composer require timonf/twigony-framework-bundle
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php file of your project:
<?php // app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new \Twigony\Bundle\FrameworkBundle\TwigonyFrameworkBundle(), ); } }
Documentation
- TemplateController for static pages (
_controller: twigony.template_controller:templateAction) - SecurityController for login page (
_controller: twigony.security_controller:loginAction) - SwiftMailerController for email forms (
_controller: twigony.mailer_controller:emailAction) - DoctrineORMController for database operations (
_controller: twigony.template_controller:*)
Example usages
Multiple static pages (TemplateController)
-
Create two or more Twig templates (like
app/views/info/hello.html.twigandapp/views/info/about.html.twig) -
Extend your
routing.yml:info_pages: path: '/info/{page}' defaults: _controller: 'twigony.template_controller:templateAction' template: 'info/{page}.html.twig'
List entities (DoctrineORMController)
-
Create an entity or use an existing one (e .g.
src/AppBundle/Entity/Post.php) -
Create a template (like
app/views/posts/all.html.twig) -
Extend your
routing.yml:posts: path: '/posts' defaults: _controller: 'twigony.orm_controller:listAction' template: 'posts/all.html.twig' entity: 'AppBundle\Entity\Post' options: as: 'posts' # Access variable for your Twig template. You can use it this way `{% for post in posts %}…` perPage: 50
Show single entity (DoctrineORMController)
-
Create an entity or use an existing one (e .g.
src/AppBundle/Entity/Post.php) -
Create a template (like
app/views/posts/show.html.twig) -
Extend your
routing.yml:show_post: path: '/posts/{id}' # Make sure, you are using "id" as id parameter! defaults: _controller: 'twigony.orm_controller:viewAction' template: 'posts/show.html.twig' entity: 'AppBundle\Entity\Post' options: as: 'post' # Access variable for your Twig template. You can use it this way `{{ post.title }}…`
timonf/twigony-framework-bundle 适用场景与选型建议
timonf/twigony-framework-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 22 次下载、GitHub Stars 达 3, 最近一次更新时间为 2017 年 04 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「routing」 「twig」 「template」 「frontend」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 timonf/twigony-framework-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 timonf/twigony-framework-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 timonf/twigony-framework-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Shoot aims to make providing data to your templates more manageable
This Symfony bundle integrates PhpSpreadsheet into Symfony using Twig.
A Twig extension to insert css as inline styles with a tag
Caching and compression for Twig assets (JavaScript and CSS).
The bundle for easy using json-rpc api on your project
Write down your routing mapping at one place
统计信息
- 总下载量: 22
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-04-11