Im new to the forum and hopefully Im posting as I should!
I have an site already but I want to start using Phalcon PHP framework for better and, hopefully, easier URL rewriting.
I have been experimenting with Phalcon using the tutorials but I dont seem to get an answer on how to implement existing site on to Phalcon.
I dont want to go in to big details about the site and hopefully it wont be needed. My site is about showing "regions" and "cities" in these regions and some more info, but lets just stick to these. there is only a index.php which includes regions.php and cities.php and the url can look like: www.mysite.com/arizona/phoenix
The thing about the site is that even if it say ../arizona/phoenix we are still on the index.php. (So if someone types mysite.com/arizona i store the region in the url and use it in index.php to get te right info about the place. I dont even know if this info is necessary, Im a bit new to all that has to do with websites but i consider myself a fast-learner.
So, my question is if I could start using Phalcon on my site and if I have to re-do the whole site because of this or if there is an smooth way to use my index.php and my includes for regions.php, cities.php, etc etc.
NOTE: for now I only want Phalcon to getaway from .htaccess.
DUE TO ANSWER: do you have any sugestions on how to solve my problem in other way? I just want to get away from htaccess but if its the only way to go I have to. I just want to know my options =)
Obviously you will need to make some modifications to your code but it's doable in reasonable time. Instead of rewriting everything you can create your router using Phalcon Micro. It's even faster than his bigger incarnation!
<?php
use Phalcon\Mvc\Micro;
$app = new Micro();
$app->get('/posts/{year:[0-9]+}/{title:[a-zA-Z\-]+}', function ($year, $title) {
echo "<h1>Title: $title</h1>";
echo "<h2>Year: $year</h2>";
});
$app->handle();
Details are well described in documentation: https://docs.phalconphp.com/pl/latest/reference/micro.html#defining-routes
Hope you'll like this awesome framework!