Replies: 1 comment 4 replies
-
By hooks do you mean: $app->get(
'/api/robots',
function () {
}
); for example? If so, they're typically called "routes". How you organize them generally depends on how large your application is. The simplest solution would be to just put each route in a separate file, named for the method & URL they handle, ie: <?php
use Phalcon\Mvc\Micro;
$app = new Micro();
include "routes/get--api-robots.php";
include "routes/get--api-robots-search-name.php";
include "routes/get--api-robots-search-id.php";
include "routes/post--api-robots.php";
$app->handle(
$_SERVER["REQUEST_URI"]
); |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a RESTFul application as documented https://docs.phalcon.io/4.0/en/tutorial-rest
Now I'm getting a lot of hooks, all managed in index.php file and it's growing a lot.
How can I split index.php in subfiles?
Beta Was this translation helpful? Give feedback.
All reactions