appventus/shortcuts-bundle
最新稳定版本:1.1
Composer 安装命令:
composer require appventus/shortcuts-bundle
包简介
Symfony ShortcutsBundle
关键字:
README 文档
README
Awesome Shortcuts Bundle
What is the point ?
This bundle allows you to easily add and use shortcuts for your dev apps.
Install
This procedure describes the installation of the project for use in a virtual machine vagrant.
Recovery Bundle
Composer
Add the following lines in your composer.json :
{
"require": {
"appventus/shortcuts-bundle": "dev-master"
}
}
Then execute the following command:
php composer.phar update
Bundle activation
In your AppKernel.php add the following lines :
<?php
public function registerBundles()
{
$bundles = array(
// ...
new AppVentus\Awesome\ShortcutsBundle\AvAwesomeShortcutsBundle(),
);
}
Configuration
Twig
Add the following lines in Config.yml :
# Sf=2.*
twig:
form:
resources:
- 'AvAwesomeShortcutsBundle::fields.html.twig'# Twig Configuration
# Sf>=3.*
twig:
form_themes:
- 'AvAwesomeShortcutsBundle::fields.html.twig'
In your layout file, load the following files :
'@AvAwesomeShortcutsBundle/Resources/public/css/datepicker.css'
'@AvAwesomeShortcutsBundle/Resources/public/js/bootstrap-datepicker.js'
Using shortcuts
A service allows the use of functions used in many applications.
Eg. in a controller:
$shorcutService = $this->get('av.shorcuts');
$shorcutService->getSession(...
$shorcutService->setSession(...
$shorcutService->createAndQueueMail(...
$shorcutService->createAndSendMail(...
View ShortcutService file for a complete list of shortcuts and their parametres.
FormErrorService
As it is common to submit forms by ajax, it is desired to return the error forms of a string
The FormErrorService transforms errors on a form (and its sub-forms) into a string.
Eg. in a controller:
$form = ... //some form
if ($form->isValid()) {
...
} else {
$formErrorService = $this->get('av.form_error_service');
$errorsAsString = $formErrorService->getRecursiveReadableErrors($form);
}
Integration with AvAlertifyBundle
This bundle brings a lot of shortcuts for AvAlertify bundle to standardize all alerts for your application.
Instead of using:
$this->get('session')->getFlashBag()->add('noty', array(
'type' => $type,
'layout' => $layout,
'body' => $content,
'translationDomain' => $translationDomain
)
);
or worse
$this->session->getFlashBag()->add('success', 'Congratulations !');
We can now use the following shortcuts from the av.shortcuts Service :
$this->container->get('av.shortcuts')->congrat($content, $layout, $translationDomain);
or any of our controller inheriting AwesomeController :
$this->congrat('Congratulations !'); // Success
$this->warn('Careful, this is important !'); // Warning
$this->inform('Did you know ?'); // Information
$this->scold('Oups something went wrong !'); // Error
RedactorType
Add the assetic injector redactor tag
$redactorOptions = [ 'lang' => $this->request->getLocale(), 'plugins' => ['video'], 'buttons' => ['html', 'formatting', 'bold', 'italic', 'underline', 'deleted', 'unorderedlist', 'orderedlist', 'outdent', 'indent', 'image', 'video', 'link', 'alignment', 'horizontalrule'], 'imageUpload' => '/bundles/avawesomeshortcuts/libs/redactor/scripts/image_upload.php', ]; $builder->add('description', RedactorType::class, [ 'options' => $redactorOptions ]);
appventus/shortcuts-bundle 适用场景与选型建议
appventus/shortcuts-bundle 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 17.96k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2013 年 01 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「controller」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 appventus/shortcuts-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 appventus/shortcuts-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 appventus/shortcuts-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Give your JS App some Backbone with Models, Views, Collections, and Events.
Create mail from controller action render
Extended auth components for Yii2
A simple PSR-7 based HTTP middleware queue
A Yii2 extension that includes the concept of roles in the framework. Useful to handle user access to controllers actions allowed only for some roles and filter database resources.
Easy CRUDs.
统计信息
- 总下载量: 17.96k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 14
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-01-29
