{"id":15021889,"url":"https://github.com/php/pecl-system-yaf","last_synced_at":"2025-10-19T22:31:45.358Z","repository":{"id":7226182,"uuid":"8534103","full_name":"php/pecl-system-yaf","owner":"php","description":"PHP Framework in PHP extension","archived":false,"fork":false,"pushed_at":"2018-10-04T05:55:08.000Z","size":670,"stargazers_count":26,"open_issues_count":0,"forks_count":18,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-09-26T06:32:11.272Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://pecl.php.net/package/yaf","language":"C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/php.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-03T09:05:58.000Z","updated_at":"2025-06-25T07:31:02.000Z","dependencies_parsed_at":"2022-09-04T23:12:40.514Z","dependency_job_id":null,"html_url":"https://github.com/php/pecl-system-yaf","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/php/pecl-system-yaf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fpecl-system-yaf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fpecl-system-yaf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fpecl-system-yaf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fpecl-system-yaf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php","download_url":"https://codeload.github.com/php/pecl-system-yaf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fpecl-system-yaf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279927568,"owners_count":26245503,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-19T02:00:07.647Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T19:57:11.320Z","updated_at":"2025-10-19T22:31:45.054Z","avatar_url":"https://github.com/php.png","language":"C","readme":"# Yaf - Yet Another Framework  \n[![Build Status](https://secure.travis-ci.org/laruence/php-yaf.png)](https://travis-ci.org/laruence/php-yaf)\n\nPHP framework written in c and built as a PHP extension.\n\n## Requirement\n- PHP 5.2 +\n\n## Install\n### Install Yaf \nYaf is an PECL extension, thus you can simply install it by:\n\n```\n$pecl install yaf\n```\n### Compile Yaf in Linux\n```\n$/path/to/phpize\n$./configure --with-php-config=/path/to/php-config\n$make \u0026\u0026 make install\n```\n### For windows \nYaf binary dlls could be found at http://code.google.com/p/yafphp/downloads/list\n\n## Document\nYaf manual could be found at: http://www.php.net/manual/en/book.yaf.php\n\n## IRC\nefnet.org #php.yaf\n\n## Tutorial\n\n### layout\nA classic Application directory layout:\n\n```\n- .htaccess // Rewrite rules\n+ public\n  | - index.php // Application entry\n  | + css\n  | + js\n  | + img\n+ conf\n  | - application.ini // Configure \n- application/\n  - Bootstrap.php   // Bootstrap\n  + controllers\n     - Index.php // Default controller\n  + views    \n     |+ index   \n        - index.phtml // View template for default controller\n  - library\n  - models  // Models\n  - plugins // Plugins\n```\n### DocumentRoot\nyou should set DocumentRoot to application/public, thus only the public folder can be accessed by user\n\n### index.php\nindex.php in the public directory is the only way in of the application, you should rewrite all request to it(you can use .htaccess in Apache+php mod) \n\n```php\n\u003c?php\ndefine(\"APPLICATION_PATH\",  dirname(dirname(__FILE__)));\n\n$app  = new Yaf_Application(APPLICATION_PATH . \"/conf/application.ini\");\n$app-\u003ebootstrap() //call bootstrap methods defined in Bootstrap.php\n    -\u003erun();\n```\n### Rewrite rules\n\n#### Apache\n\n```conf\n#.htaccess\nRewriteEngine On\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteRule .* index.php\n```\n\n#### Nginx\n\n```\nserver {\n  listen ****;\n  server_name  domain.com;\n  root   document_root;\n  index  index.php index.html index.htm;\n \n  if (!-e $request_filename) {\n    rewrite ^/(.*)  /index.php/$1 last;\n  }\n}\n```\n\n#### Lighttpd\n\n```\n$HTTP[\"host\"] =~ \"(www.)?domain.com$\" {\n  url.rewrite = (\n     \"^/(.+)/?$\"  =\u003e \"/index.php/$1\",\n  )\n}\n```\n\n### application.ini\napplication.ini is the application config file\n```ini\n[product]\n;CONSTANTS is supported\napplication.directory = APP_PATH \"/application/\" \n```\nalternatively, you can use a PHP array instead: \n```php\n\u003c?php\n$config = array(\n   \"application\" =\u003e array(\n       \"directory\" =\u003e application_path . \"/application/\",\n    ),\n);\n\n$app  = new yaf_application($config);\n....\n  \n```\n### default controller\nIn Yaf, the default controller is named IndexController:\n\n```php\n\u003c?php\nclass IndexController extends Yaf_Controller_Abstract {\n   // default action name\n   public function indexAction() {  \n        $this-\u003egetView()-\u003econtent = \"Hello World\";\n   }\n}\n?\u003e\n```\n\n###view script\nThe view script for default controller and default action is in the application/views/index/index.phtml, Yaf provides a simple view engineer called \"Yaf_View_Simple\", which supported the view template written by PHP.\n\n```php\n\u003chtml\u003e\n \u003chead\u003e\n   \u003ctitle\u003eHello World\u003c/title\u003e\n \u003c/head\u003e\n \u003cbody\u003e\n   \u003c?php echo $content; ?\u003e\n \u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Run the Applicatioin\n  http://www.yourhostname.com/\n\n## Alternative\nyou can generate the example above by using Yaf Code Generator:  https://github.com/laruence/php-yaf/tree/master/tools/cg\n\n## More\nMore info could be found at Yaf Manual: http://www.php.net/manual/en/book.yaf.php\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp%2Fpecl-system-yaf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp%2Fpecl-system-yaf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp%2Fpecl-system-yaf/lists"}