LoginSignup
2
2

More than 5 years have passed since last update.

PhalconのRoutingをymlで管理したい!

Last updated at Posted at 2016-10-21

PhalconのRoutingをymlで管理したい!

Phalconのconfigをymlで管理したい!環境[ENVIRONMENT]も切り分けたい!に引き続き、Routingも配列じゃなくymlで運用したい。

なので、作ってみました。

こちらも、php7+Phalcon3.0.xでしかテストしてませんが
基本、全てのバージョンで動くはず!

github

PhalconConfig

routing.yml sample

min

mypage_index: # /mypage/index

max

mypage_index:
  module:     frontend # Default null
  method:     [ GET, POST ] # Default GET
  url:        /mypage/{user_id}
  controller: mypage
  action:     index
  namespace:  \ProjectName\Module

app/config/services.php

app/config/services.php
$di->set('router', function () {
    return \PhalconRouter\Yaml::load(
        new \Phalcon\Config\Adapter\Yaml(APP_PATH ."/directory/routing.yml")
    );
}, true);
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2