V
V
verericio2016-09-04 19:35:12
PHP
verericio, 2016-09-04 19:35:12

How to gradually transfer a self-written project to Phalcon?

Now there is a self-written project running on a bundle of PHP 5.3 + Mysql + Nginx + Apache,
I understand that it was necessary to switch to the framework for a long time, but this opportunity has appeared only now, tell me if it is possible not to immediately rewrite everything on Phalcon, but gradually start switching to it and how to do it right.
What additional technologies/components will be required.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
metallix, 2016-09-05
@verericio

At the moment, we are rewriting two projects from the under-framework to the Falcon. Everything happens gradually. In the main index.php file, there is a check - something like -

if (\Rapid\Migration::isPhalconRoute($_SERVER['REQUEST_URI'])) { 
 // то этот рут, обрабатывает фалкон.
}

in the Migration class there is a function, in which there is an array with roots that should be processed by the falcon. prim -
/**
     * Detects phalcon routes by uri
     *
     * @param $uri
     * @return bool
     */
    public static function isPhalconRoute($uri)
    {
        // Refactoring to phalcon (1:1 routes)
        $phalconUris = array(
            '/categories',
            '/counter/itemhit',
            '/counter/videohit',
            '/counter/bloghit',
            '/statistic/sales_views',
            '/statistic/receive_vat',
            '/contacts',
            '/gallery',
            '/blog',
            '/pages',
            '/users/login',
            '/users/registration',
            ....
            ....
          
      foreach ($phalconUris as $p_uri) {
            if (strpos($uri, $p_uri) !== false) {
                return true;
            }
        }
}

Well, that's it in a nutshell. The bottom line is that this whole process is gradual. Some parts of the project are already working on Falcon, and some are still being processed by the old framework. And so on until the process is complete, then you can simply delete the old files, and work completely on the falcon.

O
Optimus, 2016-09-04
Pyan @marrk2

VDS is needed because for Phalcon, the extension to C seems to be installed. And with the release of php7, its expediency is still in question.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question