개발/php
php라우팅 라이브러리 : phroute
yunzema
2018. 12. 18. 09:41
반응형
PHP로 REST API를 구현하기 위해 시도하면서 PHP에서 간편하게 라우팅을 구현할 수 있는 라이브러리를 찾게됨.
composer에서 간편하게 설치 가능. composer 사용법은 composer에 대한 게시물 참조 할 것
1. composer.json 입력 후 설치
{
"require":
{
"phroute/phroute": "1.*"
}
}
composer install
or
2. composer 설치
composer require phroute/phroute
phroute 깃헙 링크 : https://github.com/mrjgreen/phroute
간단 예제 튜토리얼 : https://www.sitepoint.com/fast-php-routing-phroute/
** 사용시 사용하는 웹서버에 맞게 경로 디렉팅이 필요하다
nginx의 경우 nginx.conf
apache의 경우 .htaccess
윈도우의 경우 web.config
로 따로 설정이 필요하다.