PHP 开发框架,CakePHP 3.1.0 发布

jopen 9年前

CakePHP是一个运用了诸如ActiveRecord、Association Data Mapping、Front Controller和MVC等著名设计模式的快速开发框架。该项目主要目标是提供一个可以让各种层次的PHP开发人员快速地开发出健壮的Web应用,而 又不失灵活性。主要特性:

基于MVC架构
视图支持Ajax
内置校验框架
提供应用程序的基础模块和CRUD 代码自动生成功能
提供处理session,request,security的组件
灵活的视图缓存功能
面向对象
无需配置:只要安装好数据库
兼容PHP4和PHP5。

CakePHP 3.1.0 发布,此版本包含大量的改进:

  • ORM 增强

  • Mailers 允许创建可重用邮件

  • 模板提供额外的模板变量

  • Shell Helpers 可以让你轻松打包复杂输出生成代码

  • 刷新默认应用样式

相比 3.0 一些重要的改进:

  • FlashComponent now stacks Flash messages created with the set() or __call() methods. This means that the structure in the Session for stored Flash messages has changed.

  • New configuration option storage has been added. It contains the storage class name that AuthComponent uses to store user record. By default SessionStorage is used.  If using a stateless authenticator you should configure AuthComponent to use MemoryStorage instead.

  • You can now also configure AuthComponent to do the auth check before controller's beforeFilter() callback is run using the checkAuthIn configuration. This is particularly useful when using stateless authenticators.

  • RequestHandlerComponent now switches the layout and template based on the parsed extension or Accept-Type header in the beforeRender() callback instead of startup() callback.

  • The default mime-type used when sending requests has changed in Http\Client. Previously multipart/form-data would always be used. In 3.1, multipart/form-data is only used when file uploads are present. When there are no file uploads, application/x-www-form-urlencoded is used.

其他改进

  • The default route class has been changed to DashedRoute in the cakephp/app repository. Your current code base is not affected by this, but it is recommended to use this route class from now on.

  • The breakpoint() helper function has been added. This function provides a snippet of code that can be put into eval() to trigger an interactive console.

  • Shell::dispatchShell() no longer outputs the welcome message from the dispatched shell.

  • You can now set _serialized to true for JsonView and XmlView to serialize all view variables instead of explicitly specifying them.

  • Time::fromNow() has been added. This method makes it easier to calculate differences from 'now'.

  • Time::i18nFormat() now supports non-gregorian calendars when formatting dates.

  • Validation::latitude(), and Validation::longitude() were added.

  • Validation::ascii(), Validation::utf8(), andValidation::isInteger() were added.

  • Cache::add() was ported from 2.x. This method allows you to atomically add data to a cache backend if the key did not already exist.

  • Time::listTimezones() now supports options to display timezone abbreviations.

  • Hash::get() now supports objects implementing ArrayAccess.

  • Hash::sort() supports case-insensitive sorting through a new ignoreCase option.

废弃功能

  • The SessionHelper has been deprecated. You can use $this->request->session() directly.

  • The following Controller properties are now deprecated:

    Instead of setting these properties on your controllers, you should set them using the ViewBuilder.

    • layout

    • view

    • theme

    • autoLayout

    • viewPath

    • layoutPath

    </ul>

    升级

    php composer.phar require 'cakephp/cakephp:3.1.*'  php composer.phar require 'cakephp/debug_kit:3.2.*'  php composer.phar require 'cakephp/bake:1.1.*'

    下载:cakephp-3-1-0.zip