{"id":13469800,"url":"https://github.com/laruence/yaf","last_synced_at":"2025-05-14T08:06:47.981Z","repository":{"id":2034285,"uuid":"2970982","full_name":"laruence/yaf","owner":"laruence","description":"Fast php framework written in c, built in php extension","archived":false,"fork":false,"pushed_at":"2024-06-28T08:55:25.000Z","size":1979,"stargazers_count":4521,"open_issues_count":97,"forks_count":1373,"subscribers_count":451,"default_branch":"master","last_synced_at":"2024-10-29T15:35:56.878Z","etag":null,"topics":["c","php","php-framework","yaf"],"latest_commit_sha":null,"homepage":"http://pecl.php.net/package/yaf","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"zhanglp92/mmu","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/laruence.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"laruence","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"custom":null}},"created_at":"2011-12-13T08:56:42.000Z","updated_at":"2024-10-23T09:18:27.000Z","dependencies_parsed_at":"2024-01-19T17:02:10.962Z","dependency_job_id":"0f816dfd-75c0-4298-b872-cc5cd66a0a36","html_url":"https://github.com/laruence/yaf","commit_stats":{"total_commits":902,"total_committers":40,"mean_commits":22.55,"dds":0.1352549889135255,"last_synced_commit":"d1628daa62ed3218df1ad0c5f2f615e63c6780f9"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laruence%2Fyaf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laruence%2Fyaf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laruence%2Fyaf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laruence%2Fyaf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laruence","download_url":"https://codeload.github.com/laruence/yaf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101618,"owners_count":22014909,"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","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":["c","php","php-framework","yaf"],"created_at":"2024-07-31T16:00:16.690Z","updated_at":"2025-05-14T08:06:42.969Z","avatar_url":"https://github.com/laruence.png","language":"C","readme":"# Yaf - Yet Another Framework  \n[![Build status](https://ci.appveyor.com/api/projects/status/awii6wf2ocmy202p/branch/master?svg=true)](https://ci.appveyor.com/project/laruence/yaf/branch/master) [![Build Status](https://github.com/laruence/yaf/workflows/integrate/badge.svg)](https://github.com/laruence/yaf/actions?query=workflow%3Aintegrate)\n\nPHP framework written in c and built as a PHP extension.\n\n## Requirement\n- PHP 7.0+  (master branch))\n- PHP 5.2+  ([php5 branch](https://github.com/laruence/yaf/tree/php5))\n\n## Install\n### Install Yaf \nYaf is a 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\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## For IDE\nYou could find a documented prototype script here: https://github.com/elad-yosifon/php-yaf-doc\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 // libraries\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\n`index.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\n`application.ini` is the application config file\n```ini\n[product]\n;CONSTANTS is supported\napplication.directory = APPLICATION_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 engine called \"Yaf_View_Simple\", which support the view template written in 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 Application\n  http://www.example.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./yaf_cg -d output_directory [-a application_name] [--namespace]\n```\n\n## More\nMore info could be found at Yaf Manual: http://www.php.net/manual/en/book.yaf.php\n","funding_links":["https://github.com/sponsors/laruence"],"categories":["C","网站框架","PHP"],"sub_categories":["框架"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaruence%2Fyaf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaruence%2Fyaf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaruence%2Fyaf/lists"}