Peas framework 0.6 officially released Solutions

Source: Internet
Author: User
Tags autoload
Bean framework 0.6 was officially released [color #339966]. The Bean framework (WonderfulFramework): [color] is a PHP development framework that supports PHP5 and later versions. it is free and open-source, it is issued based on the BSD protocol. & nbsp; it is a flexible, scalable, configurable, and componentized framework structure. adopting the object-oriented design concept and supporting the traditional process-oriented architecture, the pea framework 0.6 was officially released.
[Color = #339966] pea Framework (Wonderful Framework): [/color]It is a PHP development framework that supports PHP5 and later versions. it is free and open-source and is released based on the BSD protocol.
It is a flexible, scalable, configurable, and componentized framework structure. it adopts the object-oriented design concept and supports traditional process-oriented development methods that directly embed PHP code in HTML.
Support for the MVC mode allows programmers to better cooperate with the artist, and even the artist does not need to use PHP.
PhpTagLib, Action, and so on. These technologies allow developers to better develop a powerful hierarchical design architecture.
Integration includes unit testing/object imitation, and dependency injection architecture to better support agile development.
The framework references the technologies in JAVA and makes further use of these technologies.
There are still many shortcomings in the framework that need to be improved constantly. You are welcome to give more comments. if you have any questions, please give us feedback. thank you for your participation!

* Flexible, highly scalable, and highly reusable. it fully adopts the object-oriented design and comes with some useful class libraries.
* Dependency injection implements the IoC architecture to better reduce class dependencies for developers.
* Address ING is the basis of the framework. developers can define their own matching addresses and map them to specialized classes for running.
* The TAG engine. PhpTagLib is an important MVC implementation in the framework. It allows developers to define tags such as HTML and XML for componentized development.
* The Action module is a powerful data processing framework. it supports tag calling and the combination of multiple actions.
* The Iterator extends the Iterator interface of PHP and integrates it with other modules in the framework.
* Database, re-encapsulating pear db, supporting simultaneous connection to multiple databases, and providing direct query through tags.
* The paging class separates the data paging and paging guide lines to better expand the paging. based on the iterator, the iterator can Paging any data.
* Cache: provides a unified cache architecture, allowing developers to conveniently scale and cache the content on pages by caching tags.
* The test engine supports TDD development methods and agile development necessities. It also supports running a test case separately and a test group.
* Object imitation: not only the class/interface specified by Mock, but also the Mock parent class to be separated from the parent class for testing.
* PlainObject supports writing a common class without inheriting any class or implementing any interface. it can be directly used as a label class or an Action class.
* For traditional pages, you can directly access traditional PHP pages, HTML pages, images, scripts, and other files.
* A single portal allows you to set the framework environment in the Portal program.
* Debugging: supports more detailed error/exception provision, and prompts some information in the environment.
* Configuration files in XML format make the configuration more intuitive and flexible.
* Comes from some basic and common class libraries in PEAR.
* Free, open-source, and released using the BSD open-source protocol. you can use it in any project.

Framework website:
Google Code:


Related articles:
MVC hierarchical design of PhpTagLib
Introduction to Iterator and Page class libraries
Features of actions in the framework: Components and combinations
Use FCKEditor in the framework

Some time to release a new version during the Chinese New Year.
This framework mainly targets system development and provides some agile technologies.
With the continuous application and practice of the framework in actual projects, the overall architecture has become stable, and some improvements have been made in ease of use.
In the future, the framework will continue to improve the architecture, enrich various libraries (class libraries, tag libraries, Action libraries, and Validator libraries), enhance ease of use, increase the control platform, and improve efficiency.

------ Solution --------------------
Where is the document? Where is the document?
------ Solution --------------------
Let's take a look at the demo.

Your framework is not suitable for php

1. the framework does not even implement autoload. it is very troublesome to reference include files in PHP.
2. Why can't I see M and V in MVC? if the "PhpTagLib" is counted as V, it is a little stubborn.
3. the parameters of actions are complex-"WDF_ActionForm & $ form, WDF_ActionErrors & $ errors". The simpler the parameter, the better, if you do not have an IDE or automatic code generation tool.
4. use $ this-> response-> writeln for output. this is too complicated. $ This-> output is not quite good
5. configuration files in XML format can be directly implemented using PHP Array, and the readability is not bad. PHP itself is a dynamic script and should be well utilized.
6. is it complicated to use $ form-> getValue to obtain the action parameter?
Public function process (string $ username) {...} is the best.

This framework is too well-regulated. you need to know that PHP is an inefficient dynamic scripting language. Unlike java/C #, such a framework is not suitable for PHP.

------ Solution --------------------
First of all, I have not read the source code, so please forgive me for some exceptions.

> 1. the framework does not even implement autoload. it is very troublesome to reference include files in PHP.
> How do I want to join this very early? I think so. how does autoload know which file to load? Through class naming rules? That category will take a long time! A namespace may be available, but PHP5.3 only supports the namespace. but in this case, the name is still very long. what is the convenience of using an alias than using include?

Generally, you can use the class name to implement autoload. based on the priority, you can find the corresponding files in each directory. if there is a class with the same name, you can use a class similar to using (...); to set a global tag, telling the directory to which autoload should take precedence over.
The implementation of autoload depends mainly on the directory organization of lib. if the organization is good, autoload is much easier to implement.


> 3. the parameters of actions are complex-"WDF_ActionForm & $ form, WDF_ActionErrors & $ errors". if you do not have an IDE or tools to automatically generate code, the simpler the parameter, the better.
> Well, I agree that the simpler the parameter, the better, but it is already the simplest. the two parameter objects have already classified the main data.

Why should we pass $ form as a controller member instead of a parameter?
Why not use php built-in exception handling? Class ActionException extends Exception {...}
Throw new ActionException (...);


> 6. to obtain the action parameter, use $ form-> getValue. is it complicated?
> Public function process (string $ username) {...} is the best.
> Not the best, but worse. a username and a parameter, what about other data? Add one to make it worse.

I mean:
Public function process (string $ username ){...}
$ Username is a required parameter. if it is missing, the controller reports an error.

Public function process (string $ username = null ){...}
$ Username is an optional parameter.

Other parameters passed on the page can still be accessed through $ form

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.