このサイトはCakePHPの組み込みライブラリ「Inflector」を試すサイトです。

※ 当サイトはCakePHP 1.2.6を使用しています。


最近追加されたキーワード:

Inflectorを実行した結果

Inflector::pluralize reminders
Inflector::singularize reminder
Inflector::camelize Reminder
Inflector::underscore reminder
Inflector::humanize Reminder
Inflector::tableize reminders
Inflector::classify Reminder
Inflector::variable reminder
Inflector::slug reminder

CakePHP 規約

model
モデル名 Reminder 単語始まりが大文字、単数形
Inflector::singularize(Inflector::classify($word));
モデルのファイル名 reminder.php アンダースコア、全部小文字、単数形
Inflector::singularize(Inflector::slug(strtolower($word))).'.php';
Table Name reminders アンダースコア、全部小文字、複数形
Inflector::pluralize(Inflector::slug(strtolower($word)));
controller
コントローラー名 Reminders 単語始まりが大文字、複数形
Inflector::pluralize(Inflector::classify($word));
コントローラーのクラス名 RemindersController 単語始まりが大文字、複数形、最後にControllerを追加
Inflector::pluralize(Inflector::classify($word)).'Controller';
コントローラーのファイル名 reminders_controller.php アンダースコア、全部小文字、複数形、最後に_controllerを追加
Inflector::pluralize(Inflector::slug(strtolower($word))).'_controller.php';
uses用の名前 Reminder モデル名
Inflector::singularize(Inflector::classify($word));
view
ビューフォルダ名 reminders アンダースコア、全部小文字、複数形
Inflector::pluralize(Inflector::slug(strtolower($word)));
ビューのファイル名 reminder.php アンダースコア、全部小文字、単数形
Inflector::singularize(Inflector::slug(strtolower($word))).'.php';

「Inflector」とは?

Inflector クラスは文字列を扱い、複数形やキャメル記法といったように単語のバリエーションをハンドルする操作を行うものです。例えば… Inflector::pluralize('example'); 上記の様なコードは「examples」という値を返します。(公式サイトより

参考情報

似たことができるサイト