Skip to content

Instantly share code, notes, and snippets.

@mikelbring
Created June 13, 2011 17:07
Show Gist options
  • Save mikelbring/1023198 to your computer and use it in GitHub Desktop.
Save mikelbring/1023198 to your computer and use it in GitHub Desktop.
Laravel IDE Helper
<?php
class Auth extends System\Auth { }
class Benchmark extends System\Benchmark { }
class Cache extends System\Cache { }
class Config extends System\Config { }
class Cookie extends System\Cookie { }
class Crypt extends System\Crypt { }
class DB extends System\DB { }
class Error extends System\Error { }
class File extends System\File { }
class Filter extends System\Filter { }
class Form extends System\Form { }
class Hash extends System\Hash { }
class HTML extends System\HTML { }
class Inflector extends System\Inflector { }
class Input extends System\Input { }
class Lang extends System\Lang { }
class Log extends System\Log { }
class Memcached extends System\Memcached { }
class Redirect extends System\Redirect { }
class Request extends System\Request { }
class Response extends System\Response { }
class Route extends System\Route { }
class Router extends System\Router { }
class Session extends System\Session { }
class Str extends System\Str { }
class Text extends System\Text { }
class URL extends System\URL { }
class View extends System\View { }
@BaNkIck
Copy link

BaNkIck commented Oct 14, 2013

A simple Artisan task to generate this file based on current defined aliases.

Usage: php artisan build_ide_helper

Contents of file: application/tasks/build_ide_helper.php

<?php
class Build_Ide_Helper_Task
{
    protected static $file = '_IDE_HELPER.php';

    public function run()
    {
        $path = $this->get_filepath();
        File::put($path, '<?php'.PHP_EOL);

        $aliases = Config::get('application.aliases');
        foreach ($aliases as $alias => $class) {
            File::append($path, 'class '.$alias.' extends '.$class.' {}'.PHP_EOL);
        }

        echo 'IDE Helper successfully generated'.PHP_EOL;
    }

    public function remove()
    {
        $path = $this->get_filepath();
        if (File::delete($path)) {
            echo 'IDE Helper successfully removed'.PHP_EOL;
        }
    }

    protected function get_filepath()
    {
        return starts_with(static::$file, '/') ? static::$file : path('base').'/'.static::$file;
    }

}

@RyanQuackenbush
Copy link

Anyone looking for Laravel 4 updates: https://github.com/barryvdh/laravel-ide-helper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment