承接 cornford/bootstrapper 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cornford/bootstrapper

Composer 安装命令:

composer require cornford/bootstrapper

包简介

An easy way to intergrate Twitter Bootstrap with Laravel.

README 文档

README

Latest Stable Version Total Downloads Build Status Scrutinizer Code Quality

For Laravel 4.x, check version 1.5.1

Think of Bootstrap as an easy way to integrate Bootstrap with Laravel 4, providing a variety of helpers to speed up development. These include:

  • Bootstrap::css
  • Bootstrap::js
  • Bootstrap::vertical
  • Bootstrap::horizontal
  • Bootstrap::inline
  • Bootstrap::text
  • Bootstrap::password
  • Bootstrap::email
  • Bootstrap::telephone
  • Bootstrap::number
  • Bootstrap::url
  • Bootstrap::range
  • Bootstrap::search
  • Bootstrap::file
  • Bootstrap::date
  • Bootstrap::datetime
  • Bootstrap::time
  • Bootstrap::textarea
  • Bootstrap::select
  • Bootstrap::checkbox
  • Bootstrap::radio
  • Bootstrap::submit
  • Bootstrap::button
  • Bootstrap::reset
  • Bootstrap::link
  • Bootstrap::secureLink
  • Bootstrap::linkRoute
  • Bootstrap::linkAction
  • Bootstrap::mailto
  • Bootstrap::none
  • Bootstrap::success
  • Bootstrap::info
  • Bootstrap::warning
  • Bootstrap::danger

Installation

Begin by installing this package through Composer. Edit your project's composer.json file to require cornford/bootstrapper.

"require": {
	"laravelcollective/html": "5.*",
	"cornford/bootstrapper": "2.*"
}

Next, update Composer from the Terminal:

composer update

Once this operation completes, the next step is to add the required service providers. Open app/config/app.php, and add the new items to the providers array.

'Collective\Html\HtmlServiceProvider',
'Cornford\Bootstrapper\BootstrapServiceProvider',

The final step is to introduce the required facades. Open app/config/app.php, and add the new items to the aliases array.

'Form'            => 'Collective\Html\FormFacade',
'HTML'            => 'Collective\Html\HtmlFacade',
'Bootstrap'       => 'Cornford\Bootstrapper\Facades\Bootstrap',

If you want to introduce the packages JavaScripts and Stylesheets, run the following command to pull them into your project.

php artisan vendor:publish --provider="Cornford\\Bootstrapper\\BootstrapServiceProvider"

That's it! You're all set to go.

Usage

In order to include the Bootstrap dependencies you will need to utilise the Bootstrap::css() and Bootstrap:js() methods in the head section of your layout / page template.

It's really as simple as using the Bootstrap class in any Controller / Model / File you see fit with:

Bootstrap::

This will give you access to

CSS

The css method includes Bootstrap CSS via either a CDN / Local file, and pass optional attributes.

Bootstrap::css();
Bootstrap::css('local', ['type' => 'text/css']);

JS

The js method includes Bootstrap JS via either a CDN / Local file, and pass optional attributes.

Bootstrap::js();
Bootstrap::js('local', ['type' => 'text/javascript']);

Vertical

The vertical method allows a form to be set in a vertical manner. This is the default form type. The vertical method can be chained before any form element is added and will continue for subsequent form elements until overwritten.

Bootstrap::vertical();
Bootstrap::vertical()->text('text', 'Text', 'Value');

Horizontal

The horizontal method allows a form to be set in a horizontal manner. This form type accepts both an input class and a label class. The horizontal method can be chained before any form element is added and will continue for subsequent form elements until overwritten.

Bootstrap::horizontal('col-sm-10', 'col-sm-2');
Bootstrap::horizontal('col-sm-10', 'col-sm-2')->text('text', 'Text', 'Value');

Inline

The inline method allows a form to be set in an inline manner. This form type accepts only a label class. The inline method can be chained before any form element is added and will continue for subsequent form elements until overwritten.

Bootstrap::inline('sr-only');
Bootstrap::inline('sr-only')->text('text', 'Text', 'Value');

Text

The text method generates a text field with an optional label, from errors and options.

Bootstrap::text('text', 'Text', 'Value', $errors);

Password

The password method generates a password field with an optional label, from errors and options.

Bootstrap::password('password', 'Password');

Email

The email method generates an email field with an optional label, from errors and options.

Bootstrap::email('email', 'Email address', 'Value');

Telephone

The telephone method generates an tel field with an optional label, from errors and options.

Bootstrap::telephone('telephone', 'Telephone Number', 'Value', $errors, array('pattern' => '^(?:(?:\(?(?:0(?:0|11)\)?[\s-]?\(?|\+)44\)?[\s-]?(?:\(?0\)?[\s-]?)?)|(?:\(?0))(?:(?:\d{5}\)?[\s-]?\d{4,5})|(?:\d{4}\)?[\s-]?(?:\d{5}|\d{3}[\s-]?\d{3}))|(?:\d{3}\)?[\s-]?\d{3}[\s-]?\d{3,4})|(?:\d{2}\)?[\s-]?\d{4}[\s-]?\d{4}))(?:[\s-]?(?:x|ext\.?|\#)\d{3,4})?$'));

Number

The number method generates an number field with an optional label, from errors and options.

Bootstrap::number('number', 'Number', 'Value', $errors, array('min' => 1, 'max' => 10, 'step' => 2));

Url

The url method generates an url field with an optional label, from errors and options.

Bootstrap::url('url', 'URL', 'Value', $errors, array('pattern' => '^(http[s]?:\\/\\/(www\\.)?|ftp:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\.@:%_\+~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?'));

Range

The range method generates an number field with an optional label, from errors and options.

Bootstrap::range('range', 'Range', 'Value', $errors, array('min' => 1, 'max' => 10, 'step' => 2));

Search

The search method generates an search field and icon with an optional label, from errors and options.

Bootstrap::number('search', 'Search', 'Value');

File

The file method generates a file field with an optional label, from errors and options.

Bootstrap::file('file', 'File');

Date

The date method generates a date field with a date picker, with an optional label, from errors, input options, and javascript parameters.

Bootstrap::date('date', 'Date');
Bootstrap::date('date', 'Date', date('d-m-Y'), $errors, [], ['format' => 'DD-MM-YYYY']);

Datetime

The datetime method generates a date field with a datetime picker, with an optional label, from errors, input options, and javascript parameters.

Bootstrap::datetime('datetime', 'Date');
Bootstrap::datetime('datetime', 'Date', date('d-m-Y H:i:s'));

Time

The time method generates a date field with a time picker, with an optional label, from errors, input options, and javascript parameters.

Bootstrap::time('time', 'Time');
Bootstrap::time('time', 'Time', date('H:i:s'));

Textarea

The textarea method generates a textarea field with an optional label, from errors and options.

Bootstrap::textarea('file', 'File', 'Value');

Select

The select method generates a select field with items and an optional label, selected item, from errors and options.

Bootstrap::select('select', 'Select', ['1' => 'Item 1', '2' => 'Item 2'], 2);

Checkbox

The checkbox method generates a checkbox field with a value and an optional label, checked and options.

Bootstrap::checkbox('checkbox', 'Checkbox', 1, true);

Radio

The radio method generates a radio field with a value and an optional label, checked and options.

Bootstrap::checkbox('radio', 'Radio', 1);

Submit

The submit method generates a submit button with a value and optional attributes.

Bootstrap::submit('Submit');

Button

The button method generates a button with a value and optional attributes.

Bootstrap::button('Button');

Reset

The reset method generates a reset button with a value and optional attributes.

Bootstrap::reset('Reset');

Link

The link method generates a link button with a url, title and optional attributes and secure link.

Bootstrap::link('/', 'Link');

Secure Link

The secureLink method generates a secure link button with a url, title and optional attributes and secure link.

Bootstrap::secureLink('/', 'Link');

Link Route

The linkRoute method generates a link button with a route, title and optional parameters, attributes.

Bootstrap::linkRoute('home', 'Home');

Link Action

The linkAction method generates a link button with an action, title and optional parameters, attributes.

Bootstrap::linkAction('index', 'Home');

Mailto

The mailto method generates a mailto link button with an email address, title and optional attributes.

Bootstrap::mailto('test@test.com', 'Email');

None Alert

The none method generates a none alert with content with optional emphasis, optionally be dismissible, and optional attributes.

Bootstrap::none('A message', null, true);

Success Alert

The success method generates a success alert with content with optional emphasis, optionally be dismissible, and optional attributes.

Bootstrap::success('A success message', 'Well done!', true);

Info Alert

The info method generates an info alert with content with optional emphasis, optionally be dismissible, and optional attributes.

Bootstrap::info('An info message', 'Heads up!', true);

Warning Alert

The warning method generates a warning alert with content with optional emphasis, optionally be dismissible, and optional attributes.

Bootstrap::warning('A warning message', 'Warning!', true);

Danger Alert

The danger method generates a danger alert with content with optional emphasis, optionally be dismissible, and optional attributes.

Bootstrap::danger('A danger message', 'Oh snap!', true);

License

Bootstrapper is open-sourced software licensed under the MIT license

cornford/bootstrapper 适用场景与选型建议

cornford/bootstrapper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.73k 次下载、GitHub Stars 达 23, 最近一次更新时间为 2014 年 05 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「form」 「bootstrap」 「alerts」 「twitter」 「templates」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 cornford/bootstrapper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 cornford/bootstrapper 我们能提供哪些服务?
定制开发 / 二次开发

基于 cornford/bootstrapper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 2.73k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 25
  • 点击次数: 10
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 23
  • Watchers: 7
  • Forks: 15
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-05-12