由于yaf只是一个web框架,只负责处理web请求之类的基本功能,相当简洁,连db库都没有。于是试着把zend 2.2的db库,form库,validator库与yaf结合,写了一个demo。因为zend 2.2框架的命名空间跟yaf一样,所以用起来相当方便。
下面是demo的文件架构,参照yaf手册建立的,是一个标准的架构:
├── application │ ├── Bootstrap.php │ ├── controllers │ │ ├── Album.php │ │ ├── Application.php │ │ ├── Blogs.php │ │ ├── Device.php │ │ ├── Error.php │ │ ├── Index.php │ │ └── Product.php │ ├── library │ │ ├── Album │ │ │ ├── Filter │ │ │ │ └── Album.php │ │ │ └── Form │ │ │ └── AlbumForm.php │ │ ├── lYaf │ │ │ └── Layout.php │ │ └── Zend │ │ ├── Db(下面的都是文件夹) │ │ ├── Form │ │ ├── InputFilter │ │ ├── ServiceManager │ │ ├── Stdlib │ │ └── Validator │ ── models │ │ └── Device.php │ ├── modules │ │ └── Mod │ │ ├── controllers │ │ │ ├── Ctrl.php │ │ │ └── Index.php │ │ └── views │ │ ├── ctrl │ │ │ └── index.phtml │ │ ├── index │ │ │ └── index.phtml │ │ └── index.phtml │ └── views │ ├── album │ │ ├── add.phtml │ │ └── index.phtml │ ├── blogs │ │ └── index.phtml │ ├── device │ │ ├── index.phtml │ │ └── list.phtml │ ├── error │ │ └── error.phtml │ ├── index │ │ ├── form.phtml │ │ ├── index.phtml │ │ └── list.phtml │ ├── layouts │ │ └── frontend.phtml │ ├── product │ │ └── info.html │ └── report │ └── index.phtml ├── conf │ ├── application.ini ├─ public ├── css ├── font ├── img ├── index.php └── js