Here is a little explanation on how this project works.
- All requests are sent to index.php.
- Request is then passed to RequestHandler which will load and execute defined middlewares.
- This project has a couples of middlewares, such as:
- RoutingMiddleware - For handling http routing.
- AuthMiddleware - Handles admin authentication system.
- ValidateRouteUrlParam - Validates the url to be scraped.
- VisitCounterMiddleware - For counting and saving visits for statistical purpose.
- A RoutingMiddleware will load and dispatch the request uri.
- If dispatched uri is found, a
- Request will be passed to Matcher which will load defined controller
- A controller is responsible for executing request and generating response, it:
- Load view file and send back html response.
- Execute the scraping script and send back the scraping result as json response.
- If dispatch uri is not found, a 404(Not Found) response will be sent to browser.
- If dispatch uri's request method does not match, a 405(Method Not Allowed) will be sent to browser respectfully.
- Symfony's Twig is being used as templating language.