-
PHP 7.0+ (master branch)) -
PHP 5.2+ ( php5 branch )
$pecl install yaf
$/path/to/phpize $./ configure --with-php-config=/path/to/php-config $make && make install
- .htaccess // Rewrite rules + public | - index.php // Application entry | + css | + js | + img + conf | - application.ini // Configure - application/ - Bootstrap.php // Bootstrap + controllers - Index.php // Default controller + views |+ index - index.phtml // View template for default controller + library // libraries + models // Models + plugins // Plugins
<? php define(" APPLICATION_PATH ", dirname(dirname(__FILE__))); $ app = new Yaf_Application ( APPLICATION_PATH . " /conf/application.ini "); $ app -> bootstrap () //call bootstrap methods defined in Bootstrap.php -> run ();
#.htaccess RewriteEngine On RewriteCond %{REQUEST_FILENAME} !- f RewriteRule .* index.php
server { listen ****; server_name domain.com; root document_root; index index.php index.html index.htm; if (!- e $request_filename) { rewrite ^/(.*) /index.php/$1 last; } }
$HTTP["host"] =~ "(www.)?domain.com$" { url.rewrite = ( "^/(.+)/?$" => "/index.php/$1", ) }
[product]
; CONSTANTS is supported
application.directory = APPLICATION_PATH " /application/ "
<? php
$ config = array ( " application " => array ( " directory " => application_path . " /application/ ", ), ); $ app = new yaf_application( $ config ); . . . .
<? php
class IndexController extends Yaf_Controller_Abstract { // default action name
public function indexAction () { $ this -> getView ()-> content = " Hello World "; } } ?>
<html> <head> <title> Hello World </title> </head> <body> <? php echo $ content ; ?>
</ body >
</ html >
./yaf_cg -d output_directory [-a application_name] [--namespace]