Git Product home page Git Product logo

yaf-phpport's Introduction

#YAF ported to php to extend portability

YAF is a php framework written in C and available as an extension.

This project is a php equivalent of the C code making your code portable to any server which runs php. Please note that this project is not intended to be a replacement for the Yaf extension, should consider it an extension for making your code portable to other servers where the yaf extension is not installed or not possible to install at the moment.... Yaf C extension installed is aprox. 10 times faster then this Php equivalent....So you should consider making everything possible to install the C extension.

If you have a php project which is written using YAF and you have no controll on the hosting, or your hosting would not want to install the YAf extension, then your code will not work. Using this project the code will work, but of course at much lower speed. At least the portability of your project will increase and can run on most servers (php 5.2 is required).

Diferences:

Instead of $app->getDispatcher()->setErrorHandler("error_handler", E_RECOVERABLE_ERROR); should be used: $app->getDispatcher()->setErrorHandler("error_handler", E_RECOVERABLE_ERROR|E_USER_ERROR); as from php E_RECOVERABLE_ERROR cannot be triggered. Do not use Yaf\ENVIRON use instead \Yaf\Application::app()->environ() or \Yaf\G::iniGet('yaf.environ')

INSTALL

Copy framework folder into your project folder. Edit index.php and add this code after APPLICATION_PATH is defined:

if (!extension_loaded('yaf')) { //we should load the framework from classes include(APPLICATION_PATH . '/framework/loader.php'); }

BENCHMARK

ab -n 1000 -c 10 http://localhost/work/yaf/testApp/ On my pc yaf php ported is 10 times slower.

TESTING

  • require php >= 5.3 to run the test
  • for testing you need to have yaf be loaded as a dynamic extension from command line
  • starting php 5.3 dl() cannot be used when php is loaded from modules. Only command line or Fast CGI mode will work.
  • to run the tests go to /tests/ directory and execute
    • ./runtests.sh - when testing the php framework
    • ./runtests.sh yaf - when testing with yaf.so extension

yaf-phpport's People

Contributors

mzsolti avatar wenjun1055 avatar zxcvdavid avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.