Skip to content

Instantly share code, notes, and snippets.

@syossan27
Created June 3, 2014 09:19
Show Gist options
  • Save syossan27/2e204eadd43917eb2b09 to your computer and use it in GitHub Desktop.
Save syossan27/2e204eadd43917eb2b09 to your computer and use it in GitHub Desktop.
Laravelでお手製ライブラリを使いたい時のTips ref: http://qiita.com/syossan27/items/c69acc3044424a210932
mkdir libraries
ClassLoader::addDirectories(array(
app_path().'/commands',
app_path().'/controllers',
app_path().'/models',
app_path().'/database/seeds',
app_path().'/libraries' ←追加!
));
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php",
"app/libraries" ←追加!
]
}
<?php
class Helper
{
public static function test(){
print_r("テストだよ!");
Log::debug("テストだよ!");
}
}
index(){
Helper::test();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment