标签:framework

浏览模式: 标准 | 列表 | 图文

QEE PHP 发布

QEEPHP终于发布了,没有看到廖羽雷吃笔记本,也是一种遗憾。

要知道QeePHP可是让人等了整整一年,当年论坛上就有人说:宁可相信世上有鬼也不相信老廖的嘴。可见让人有多失望

不过,在昨天凌晨的时候,QeePHP还是提供了下载,不过下载完了之后还没有时间仔细观摩。

初步看了一下,目录结构与ZF相类似,自动加载类库也使用了spl_auto_load,因为使用了这个函数,造成的后果是,文件名全部是小写了。呵呵(不知道原因的可以去查看这个函数)

其他还没有仔细看。

可以先看官方:http://qeephp.com

3d4873b500fbf23f30f7d91a7d29fc1c

45b480023800fbc8df7be09db8f28732

5acbc8043a3a58112d224d5e91b1fe61

测试JS的速度

在mootools的官方网站有一个网页专门用来测试几个框架的速度,大概是:mootools,jquery,prototype,dojo,yui,测试下来jquery的平均速度应该算是最快的。

那个评测下来IE下JS运行速度慢果然是很明显的。同样的测试在IE下面比FF下面,速度慢了一倍左右啊。

不多了。自己测试一下看结果吧。。
http://mootools.net/slickspeed/

e1684acd4db8970cc415a9f918d7adc7

zendframework 1.6终于将SOAP放进去了

zendframework 1.6终于将SOAP放进去了

1.6版本的zf终于将SOAP放进来了,同时也增加了DOJO的支持。不过我没有想通。为什么那么多的JS框架,最终会选择了DOJO。

这些不是我能够想得通的。还是看看到底更新了什么再说吧。

An overview of new features:

  • Dojo Integration
    • JSON-RPC
    • Dojo Data packing
    • Dojo View Helper
    • Dijit integration with Zend_Form & Zend_View
    • Dojo Library Distribution
  • SOAP
    • SOAP Server
    • SOAP Client
    • Autodiscovery
    • WSDL access
    • WSDL Generation
  • Preview of Tooling Project in Laboratory (see /laboratory folder)
    • Command Line Interface
    • Project Asset Management
  • Unit Testing Harness for Controllers
  • Lucene 2.3 Index File Format Support
  • Zend_Session save handler for Database Tables
  • Paginator Component
  • Text/Figlet Support
  • ReCaptcha Service
  • Zend_Config_Xml Attribute Support
  • Character Set Option for DB Adapters
  • Zend File Transfer Component
  • New Media View Helpers (Flash, Quicktime, Object, and Page)
  • Support in Zend_Translate for INI File Format

This obviously marks a very important step towards a high-quality, highly tested 1.6 GA release. Thanks to everyone who has contributed to this release in any way: with patches/check ins, documentation/translations, and bug reports.

But our work is not yet over! Let's do our best to bring this release to the breaking point to find areas we can improve the release for General Availability. Based on your feedback we will determine in the next few weeks whether we require additional release candidates, so please provide feedback on our issue tracker (http://framework.zend.com/issues) as soon as you can and ask any questions/post your experiences on the appropriate mailing list.

Again, the Zend Framework community does NOT recommend this release for production use. We do, however, recommend evaluating new features in this release with existing and new applications.

Enjoy 1.6RC1, and see you on the issue tracker, wiki, and mailing lists!

————END————

不知道:Zend File Transfer Component,这个会给我们带来什么样的惊喜?大文件传输还是其他的?下载源码研究一下,哈哈

Zend_Acl and MVC Integration Part I (Basic Use)

Zend_Acl and MVC Integration Part I (Basic Use)

原文地址:http://devzone.zend.com/article/3509-Zend_Acl-and-MVC-Integration-Part-I-Basic-Use

原文内容:

By Aldemar Bernal

So, what is wrong with Zend_Acl and the current MVC implementation in the Zend Framework? there is nothing wrong, it is just that it gets not too obvious for developers how to achieve an optimal integration between these two important parts of the framework.

First at all, this article is based on the following Zend Framework Proporsal (link), by this moment this proposal is in Pending Recommendation state.

Well, how it works? There are two key components in this proposal:

  1. A Front Controller Plugin: This component resolves if the current user has access to the page which is being opened.
  2. An Action Helper: This component allows you to check whether the current user has access inside a controller.

Based on these two components, let's try them with an example. Let's talk about a website like DevZone, we would need a controller that work with the user management and another one which will deal with article management, as well we need 3 types of users (roles), one for guests, one for writers and another one which will approve the articles; resuming, we have:

Resources:

  1. user controller.
  2. article controller.

Roles:

  1. Guest.
  2. Writer.
  3. Admin.

Setting up the Zend_Acl component

After defined what we want to do, the next step will create a Zend_Acl instance which will reflect our model.

/** Creating the ACL object */
require_once 'Zend/Acl.php';
$myAcl = new Zend_Acl();

Creating the roles

Now we create the roles in our Zend_Acl instance.

/** Creating Roles */
require_once 'Zend/Acl/Role.php';
$myAcl->addRole(new Zend_Acl_Role('guest'))
->addRole(new Zend_Acl_Role('writer'), 'guest')
->addRole(new Zend_Acl_Role('admin'), 'writer');

Creating the resources

And then we create the resources needed (one per controller) and their relationship with the roles we created.

/** Creating resources */
require_once 'Zend/Acl/Resource.php';
$myAcl->add(new Zend_Acl_Resource('user'))
->add(new Zend_Acl_Resource('article'));

Creating the permissions

Now that we added the roles and resources to our Zend_Acl instance, it's time to explain what actions must be available to which roles.

  1. Guest won't have access to edit, add or approve an article.
  2. Writer won't have access to approve an article.
  3. Admin will have complete access.
/** Creating permissions */
$myAcl->allow('guest', 'user')
->deny('guest', 'article')
->allow('guest', 'article', 'view')
->allow('writer', 'article', array('add', 'edit'))
->allow('admin', 'article', 'approve');

Creating the access denied view file

We will need to create a view and an action which will address all those denied users, in order to do it, first we create a new action in our error controller:

class ErrorController extends Zend_Controller_Action
{
....

public function deniedAction()
{
}

....
}

And then we create our view file (/application/views/scripts/error/denied.phtml) with some warning message:

<h1>Error</h1>
<h2>Access denied</h2>
<p>You are trying to access an area which you have not allowed.</p>

Finishing the configuration

Okay, we have setup our Zend_Acl configuration, so far, it doesn't look like something new, but the next step is register the controller plugin, this important part takes the Zend_Acl instance we created and then validates it against the current page being accessed by an user.

/** Setting up the front controller */ 
require_once 'Zend/Controller/Front.php';
$front = Zend_Controller_Front::getInstance();
$front->setControllerDirectory('path/to/controllers');

/** Registering the Plugin object */
require_once 'Zend/Controller/Plugin/Acl.php';
$aclPlugin = new Zend_Controller_Plugin_Acl($myAcl);
$aclPlugin->setRoleName($currentUserRole);

$front->registerPlugin(new Zend_Controller_Plugin_Acl($acl, 'guest'));

/** Dispatching the front controller */
$front->dispatch();

After this configuration is done, once an user enters in our application, depending the role he/she has the page will be displayed or an access denied page will be displayed.

For more information about this you can go to:
Zend_Acl & MVC Integration
and here is a small implementation source code of this:
Source Code

————END————
由于本文并没有什么特别的地方,而且单词也没有什么,故不作翻译。

ZendFramewok介绍

3a98d2de71841cd612748baced5a056b

ZF 其实我并不想多做介绍,毕竟对于熟悉PHP的人来说,ZF往往还是被当成研究对象的。官方出品的东西,怎么着都有其优点存在,而且有些类似于MFC中的隐藏函数功能,在ZF里也可能会看到,平时我们不太用、但确实有用的功能,也能够在ZF里面找到。

偷懒一下,直接把framework.zend.com中的whyzf的页面COPY过来,当作ZF的介绍,呵呵。

Why Zend Framework?

Extending the art & spirit of PHP, Zend Framework is based on simplicity, object-oriented best practices, corporate friendly licensing, and a rigorously tested agile codebase. Zend Framework is focused on building more secure, reliable, and modern Web 2.0 applications & web services, and consuming widely available APIs from leading vendors like Google, Amazon, Yahoo!, Flickr, as well as API providers and cataloguers like StrikeIron and ProgrammableWeb.

Expanding on these core themes, we have implemented Zend Framework to embody extreme simplicity & productivity, the latest Web 2.0 features, simple corporate-friendly licensing, and an agile well-tested code base that your enterprise can depend upon.

Extreme Simplicity & Productivity

We designed Zend Framework with simplicity in mind. To provide a lightweight, loosely-coupled component library simplified to provide 4/5s of the functionality everyone needs and that lets you customize the other 20% to meet your specific business needs. By focusing on the most commonly needed functionality, we retain the simplified spirit of PHP programming, dramatically lower the learning curve, and your training costs – so developers get up-to-speed quickly. We do this with:

  • An extensible and well-tested code base – easy to augment
  • A flexible architecture – not locked-in to a rigid application structure
  • No configuration files necessary to get up and running – or when maintaining and deploying your apps

Frameworks and best practices mean reduced training costs and quicker time-to-market – important factors in adoption decisions. Built so you can pick and choose just the pieces you need to turbocharge your web applications – all your developers know where to find their PHP / Zend Framework code, speeding new development and reducing maintenance costs.

Latest Web Development Features

  • AJAX support through JSON – meet the ease-of-use requirements your users have come to expect
  • Search – a native PHP edition of the industry-standard Lucene search engine
  • Syndication – the data formats & easy access to them your Web 2.0 applications need
  • Web Services – Zend Framework aims to be the premier place to consume & publish web services
  • High-quality, object-oriented PHP 5 class library – attention to best practices like design patterns, unit testing, & loose coupling

Friendly & Simple Licensing, Safe for the Enterprise

Based on the simple and safe new BSD license, with Zend Framework's License, you rest assured that your code is compliant, unimpeachable, and protected as you see fit. We also require all contributors to the open source Zend Framework to complete and sign a Contributor License Agreement (CLA) — which is based on the standard open-source Apache license — protecting your own intellectual property (that is, your added-value) built on Zend Framework.

Fully Tested – Extend Safely and Easily

Tested. Thoroughly. Enterprise-ready and built with agile methods, Zend Framework has been unit-tested from the start, with stringent code coverage requirements to ensure that all code contributed has not only been thoroughly unit-tested, but also remains stable and easy for you to extend, re-test with your extensions, and further maintain.

Fleaphp介绍(在迟来的QeePhp前的最后介绍)

aa80f68268363f74e6798d4b3651ad37
主要特征:
  1. 完全跨平台
  2. 100% 兼容 PHP4 和 PHP5
  3. 不倚赖特别的 PHP 扩展模块
  4. 简单、容易理解的 MVC 模型
  5. 易于使用、高度自动化的数据库 CRUD 操作
  6. 丰富的助手对象和组件
  7. 开放源代码,完全中文化的注释和文档
  8. 商业公司提供技术支持

FleaPHP 的设计目标

FleaPHP 致力于减少开发者创建 Web 应用程序的工作量,并降低开发难度和强度,提高开发效率。

  • 快速、轻量级,避免臃肿的结构带来的性能损失

    由于 PHP 是解释执行,如果花费太多资源在框架本身,显然不适合的。就像一台计算机如果把大量的资源都花在操作系统上了,而应用程序能够得到的资源却少得可怜,显然是无法让用户接受的。

  • 可扩展、开放性的架构,允许开发者引入自己的组件或者任何成熟的工具库

    框架虽然提供了许多组件,但不可能完全满足用户的需求。因此,框架本身应该是松散耦合、可扩展的。开发者可以很简单的为框架加入新的组件。同时,框架的逐步发展也不应该影响框架的核心基础。最后,开放性的架构让开发者在框架中引入其他组件或者工具库时不会遇到任何困难。例如开发者可能会使用 Smarty 来做模板引擎,以及 PEAR 中的一些库来简化开发工作。

  • 尽可能少的契约,但同时提供足够的自动化能力,减轻开发强度

    虽然契约式编程,可以让框架本身的设计变得更简单,开发者也能从框架获得更多的帮助。但太过严格的规则和约定会明显降低框架的适应性,为此需要对两者进行适当的平衡。FleaPHP设计时采用尽可能少的契约,通过更复杂的实现来实现一些自动化能力。或者以最少量的配置信息来帮助框架为开发者提供服务。

  • 高度灵活的解决方案,提供开发应用程序的大多数基本组件

    虽然现在已经有许许多多出色的工具库可供选择。但对于一些平常的需求来说,这些工具库可能具有过度杀伤能力(也就是说工具库本身提供了远远超过需求的功能)。由此带来了学习难度增大、性能降低等问题。为此,FleaPHP 框架提供了一组轻量级的基本组件。这些组件被设计为拥有基本的功能和可扩展。 例如 FleaPHP 附带的基于角色的权限验证组件虽然不如 phpGACL 这样的库功能强大,但却能够解决平常开发都会遇到的典型权限验证问题,并允许开发者自行扩展这个组件。



FleaPHP 的主要特征

除了 MVC 模式实现、Dispatcher 调度器、模板引擎等常见功能外,FleaPHP 框架还拥有许多独一无二的特点:

  • 简单、容易理解的 MVC 模型

    不像其他流行的框架,FleaPHP 提供的 MVC 模型注重简单和容易理解。例如 FleaPHP 不要求开发者从特定的类派生自己的控制器类和业务模型类。

  • 易于使用、高度自动化的数据库 CRUD 操作

    FleaPHP 采用 TableDataGateway 设计模式来封装数据表操作。FLEA_Db_TableDataGateway 类不但提供了容易使用的 CRUD 操作,还实现了数据表之间的关联操作。同时,FleaPHP 没有像其他框架那样将每一行记录都封装为一个对象(毫无疑问这会产生明显的性能问题),而是利用 PHP 强大的数组来保存和传递数据。

  • 尽可能少的配置

    虽然像数据库联接信息等配置仍然是不可少的,但 FleaPHP 应用程序通常只需要设置几个选项,即可在各种环境中运行良好。而且 FleaPHP 的所有设置都采用 PHP 数组来保存,不但容易理解,而且省掉了解析、缓存等不必要的过程,提高了性能。

  • 高度可配置能力

    虽然 FleaPHP 自动化程度很高,但 FleaPHP 同时也拥有高度的可配置能力。通过覆盖 FleaPHP 默认的选项,开发者可以获得最大程度的灵活性。让开发者可以在适应现有代码、保持开发习惯等各方面获得好处。

  • 自动化的数据验证和转义

    即便不做任何处理,程序将数据通过 FLEA_Db_TableDataGateway 提交到数据库前。FleaPHP 也会自动对数据进行验证,并转义特殊字符,最大程度消除 SQL 注入攻击。

  • 丰富的助手对象和组件

    FleaPHP 附带了一些非常实用的助手对象,从生成图像验证码、处理文件上传到通用数据验证等。这些助手对象大多是一些独立的对象,完全不依赖于 FleaPHP 框架本身。因此开发者不但可以在 FleaPHP 之外使用这些助手对象,也可以方便的加入自己的助手对象。 组件是比助手对象更为复杂的可重用单元。这些组件包括基于角色的用户管理、脚手架等。利用这些组件,开发者可以很快的完成一些常见任务,并能在这些组件基础上扩展出功能更复杂的组件。

  • 与 Smarty 集成

    只需要修改几个选项,FleaPHP 应用程序就可以和流行的 Smarty 模版引擎集成。

  • 100% FREE

    当然,最后一点就是 FleaPHP 是一个完全开放源代码和文档(不是那种滑稽的删除了所有注释仅能运行的代码)、不限制使用的项目。你可以自由的学习、使用 FleaPHP,也可以在自己的应用程序中使用 FleaPHP。不管你的应用程序是否是商业应用,都不需要公开你的源代码,从最大程度上保护了你的知识产权。不过如果你愿意将代码反馈到社区,那么大家都会感谢你。

请记住,FleaPHP 是一个持续发展的框架,随时有新特性被加入到框架中。你现在需要,但 FleaPHP 尚未提供的功能,也许不久以后就出现在 FleaPHP 中了。当然,这需要你积极参与 FleaPHP 的发展,提出你的建议和意见。



自由的 FleaPHP

FleaPHP 是一个遵循 BSD 协议发布的开放源代码应用程序开发框架。你可以免费获取 FleaPHP 框架,并应用到自己的开发工作中。与流行的 GPL 协议不同,FleaPHP 遵循的 BSD 协议不要求开发者将基于 FleaPHP 框架开发的应用程序公布于众。这很好的保护了开发者及其所属企业的利益。更进一步,即便你基于 FleaPHP 实现了自己的产品或者对 FleaPHP 进行了修改以满足自己的需求。你仍然不需要公布你的劳动成果。

下面是关于 BSD 协议的简单介绍:

BSD 开源协议是一个给于使用者很大自由的协议。可以自由的使用,修改源代码,也可以将修改后的代码作为开源或者专有软件再发布。当你发布使用了 BSD 协议的代码,或者以 BSD 协议代码为基础做二次开发自己的产品时,需要满足三个条件:

  • 如果再发布的产品中包含源代码,则在源代码中必须带有原来代码中的 BSD 协议。
  • 如果再发布的只是二进制类库/软件,则需要在类库/软件的文档和版权声明中包含原来代码中的 BSD 协议。
  • 不可以用开源代码的作者/机构名字和原来产品的名字做市场推广。

BSD 协议鼓励代码共享,但需要尊重代码作者的著作权。BSD 由于允许使用者修改和重新发布代码,也允许使用或在 BSD 代码上开发商业软件发布和销售,因此是对商业集成很友好的协议。很多的公司企业在选用开源产品的时候都首选 BSD 协议,因为可以完全控制这些第三方的代码,在必要的时候可以修改或者二次开发。