diff --git a/application/config/anbu.php b/application/config/anbu.php
deleted file mode 100644
index 148d2933..00000000
--- a/application/config/anbu.php
+++ /dev/null
@@ -1,72 +0,0 @@
- tag.
- |
- */
-
- 'enable' => true,
-
- /*
- |--------------------------------------------------------------------------
- | Show the LOG tab.
- |--------------------------------------------------------------------------
- |
- | Display a tog showing all entries made using the Laravel Log class.
- |
- */
-
- 'tab_logs' => true,
-
- /*
- |--------------------------------------------------------------------------
- | Show the QUERIES tab.
- |--------------------------------------------------------------------------
- |
- | Display a tab showing all queries performed by the Database layer.
- |
- */
-
- 'tab_queries' => true,
-
- /*
- |--------------------------------------------------------------------------
- | Include jQuery?
- |--------------------------------------------------------------------------
- |
- | Anbu needs the jQuery JavaScript framework to function, if you are already
- | using jQuery in your templates, set this value to false.
- |
- */
-
- 'include_jquery' => true,
-
- /*
- |--------------------------------------------------------------------------
- | Event Listeners
- |--------------------------------------------------------------------------
- |
- | These are the Laravel event listeners, feel free to modify them to use
- | a different data source, or include more if necessary.
- |
- */
-
- 'event_listeners' => function()
- {
- // pass laravel log entries to anbu
- Event::listen('laravel.log', 'Anbu::log');
-
- // pass executed SQL queries to anbu
- Event::listen('laravel.query', 'Anbu::sql');
- },
-
-);
diff --git a/application/config/application.php b/application/config/application.php
index 75af1c74..8cbf104a 100755
--- a/application/config/application.php
+++ b/application/config/application.php
@@ -38,14 +38,24 @@
| remain secret and should not be shared with anyone. Make it about 32
| characters of random gibberish.
|
- | The "auto_key" option tells Laravel to automatically set this key value
- | if one has not already been set. This is generally done on the first
- | request to the Laravel splash screen.
- |
*/
'key' => 'YourSecretKeyGoesHere!',
+ /*
+ |--------------------------------------------------------------------------
+ | Profiler Toolbar
+ |--------------------------------------------------------------------------
+ |
+ | Laravel includes a beautiful profiler toolbar that gives you a heads
+ | up display of the queries and logs performed by your application.
+ | This is wonderful for development, but, of course, you should
+ | disable the toolbar for production applications..
+ |
+ */
+
+ 'profiler' => true,
+
/*
|--------------------------------------------------------------------------
| Application Character Encoding
@@ -116,7 +126,6 @@
*/
'aliases' => array(
- 'Anbu' => 'Laravel\\Anbu\\Anbu',
'Auth' => 'Laravel\\Auth',
'Asset' => 'Laravel\\Asset',
'Autoloader' => 'Laravel\\Autoloader',
@@ -141,6 +150,7 @@
'Log' => 'Laravel\\Log',
'Memcached' => 'Laravel\\Memcached',
'Paginator' => 'Laravel\\Paginator',
+ 'Profiler' => 'Laravel\\Profiling\\Profiler',
'URL' => 'Laravel\\URL',
'Redirect' => 'Laravel\\Redirect',
'Redis' => 'Laravel\\Redis',
diff --git a/application/routes.php b/application/routes.php
index 91d17aa9..2b09d557 100644
--- a/application/routes.php
+++ b/application/routes.php
@@ -35,6 +35,12 @@
Route::get('/', function()
{
+ Config::set('database.connections.mysql.password', 'password');
+ Config::set('database.connections.mysql.database', 'bundler');
+ DB::table('users')->get();
+ DB::table('users')->where_id(1)->first();
+ DB::table('users')->where_in('id', array(1, 2, 3))->get();
+ Log::error('Something went wrong!');
return View::make('home.index');
});
diff --git a/application/start.php b/application/start.php
index a6fd4f70..8d2db780 100755
--- a/application/start.php
+++ b/application/start.php
@@ -125,20 +125,6 @@
Blade::sharpen();
-/*
-|--------------------------------------------------------------------------
-| Enable The Anbu Profiler
-|--------------------------------------------------------------------------
-|
-| The Anbu profiler is an easy way to view all of your Executed SQL
-| queries, log entries and other useful data from the front-end of your
-| web app, to enable output simply add Anbu::render(); after the
-| tag of your main template, or page.
-|
-*/
-
-Anbu::register();
-
/*
|--------------------------------------------------------------------------
| Set The Default Timezone
diff --git a/laravel/anbu/anbu.php b/laravel/anbu/anbu.php
deleted file mode 100755
index e2e7c4e7..00000000
--- a/laravel/anbu/anbu.php
+++ /dev/null
@@ -1,106 +0,0 @@
-
- * @copyright 2012 Dayle Rees
- * @license MIT License
- */
-class Anbu {
-
- /**
- * An array of log entries recorded.
- *
- * @var array
- */
- private static $logs = array();
-
- /**
- * Am array of SQL queries executed.
- *
- * @var array
- */
- private static $queries = array();
-
-
- /**
- * Render Anbu, assign view params and echo out the main view.
- *
- * @return void
- */
- public static function render()
- {
- $data = array(
- 'anbu_logs' => static::$logs,
- 'anbu_queries' => static::$queries,
- 'anbu_css' => File::get(path('sys').'anbu/anbu.css'),
- 'anbu_js' => File::get(path('sys').'anbu/anbu.js'),
- 'anbu_config' => Config::get('anbu')
- );
-
- echo View::make('path: '.path('sys').'anbu/template.php', $data)->render();
- }
-
- /**
- * Add a log entry to the log entries array.
- *
- * @return void
- */
- public static function log($type, $message)
- {
- static::$logs[] = array($type, $message);
- }
-
- /**
- * Add a performed SQL query to Anbu.
- *
- * @param string $sql
- * @param array $bindings
- * @param float $time
- * @return void
- */
- public static function sql($sql, $bindings, $time)
- {
- // I used this method to swap in the bindings, its very ugly
- // will be replaced later, hopefully will find something in
- // the core
- foreach ($bindings as $b)
- {
- $count = 1;
- $sql = str_replace('?', '`'.$b.'`', $sql,$count);
- }
-
- static::$queries[] = array($sql, $time);
- }
-
- /**
- * Start Anbu's event listeners.
- *
- * @return void
- */
- public static function register()
- {
- // load the event listeners from a closure in the
- // anbu config file, this allows the user to easily
- // modify them
- $listener = Config::get('anbu.event_listeners');
- $listener();
-
- // echo anbu on laravel.done if enabled
- if(Config::get('anbu.enable'))
- {
- Event::listen('laravel.done', function() {
- Anbu::render();
- });
- }
- }
-
-}
diff --git a/laravel/anbu/template.php b/laravel/anbu/template.php
deleted file mode 100755
index bb767e3e..00000000
--- a/laravel/anbu/template.php
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- Type |
- Message |
-
-
-
- |
- |
-
-
-
-
-
There are no log entries.
-
-
-
-
-
-
-
-
- Time |
- Query |
-
-
-
- ms |
- |
-
-
-
-
-
There have been no SQL queries executed.
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/laravel/laravel.php b/laravel/laravel.php
index 3a90fe0d..0f81b6f3 100644
--- a/laravel/laravel.php
+++ b/laravel/laravel.php
@@ -143,6 +143,22 @@
Bundle::start(DEFAULT_BUNDLE);
+/*
+|--------------------------------------------------------------------------
+| Attach The Laravel Profiler
+|--------------------------------------------------------------------------
+|
+| If the profiler is enabled, we will attach it to the Laravel events
+| for both queries and logs. This allows the profiler to intercept
+| any of the queries or logs performed by the application.
+|
+*/
+
+if (Config::get('application.profiler'))
+{
+ Profiling\Profiler::attach();
+}
+
/*
|--------------------------------------------------------------------------
| Auto-Start Other Bundles
diff --git a/laravel/anbu/anbu.css b/laravel/profiling/profiler.css
similarity index 96%
rename from laravel/anbu/anbu.css
rename to laravel/profiling/profiler.css
index 343b011c..1fb4e52f 100755
--- a/laravel/anbu/anbu.css
+++ b/laravel/profiling/profiler.css
@@ -1,10 +1,3 @@
-/*
-Anbu Styles
-Copyright 2012 Dayle Rees.
-MIT License
-Intended for inclusion with the Laravel PHP Framework.
-*/
-
.anbu
{
font-family:Helvetica, "Helvetica Neue", Arial, sans-serif !important;
diff --git a/laravel/anbu/anbu.js b/laravel/profiling/profiler.js
similarity index 96%
rename from laravel/anbu/anbu.js
rename to laravel/profiling/profiler.js
index 8f86fe35..f91ad18f 100755
--- a/laravel/anbu/anbu.js
+++ b/laravel/profiling/profiler.js
@@ -1,10 +1,3 @@
-/*
-Anbu Profiler
-Copyright 2012 Dayle Rees.
-MIT License
-Intended for inclusion with the Laravel PHP Framework.
-*/
-
var anbu = {
// BOUND ELEMENTS
@@ -169,6 +162,4 @@ var anbu = {
jQuery(document).ready(function () {
// launch anbu
anbu.start();
-});
-
-
+});
\ No newline at end of file
diff --git a/laravel/profiling/profiler.php b/laravel/profiling/profiler.php
new file mode 100644
index 00000000..5acb3f6d
--- /dev/null
+++ b/laravel/profiling/profiler.php
@@ -0,0 +1,84 @@
+ array(), 'logs' => array());
+
+ /**
+ * Get the rendered contents of the Profiler.
+ *
+ * @return string
+ */
+ public static function render()
+ {
+ return render('path: '.__DIR__.'/template'.BLADE_EXT, static::$data);
+ }
+
+ /**
+ * Add a log entry to the log entries array.
+ *
+ * @return void
+ */
+ public static function log($type, $message)
+ {
+ static::$data['logs'][] = array($type, $message);
+ }
+
+ /**
+ * Add a performed SQL query to the Profiler.
+ *
+ * @param string $sql
+ * @param array $bindings
+ * @param float $time
+ * @return void
+ */
+ public static function query($sql, $bindings, $time)
+ {
+ foreach ($bindings as $binding)
+ {
+ $sql = preg_replace('/\?/', $binding, $sql, 1);
+ }
+
+ static::$data['queries'][] = array($sql, $time);
+ }
+
+ /**
+ * Attach the Profiler's event listeners.
+ *
+ * @return void
+ */
+ public static function attach()
+ {
+ // First we'll attach to the query and log events. These allow us to catch
+ // all of the SQL queries and log messages that come through Laravel,
+ // and we will pass them onto the Profiler for simple storage.
+ Event::listen('laravel.log', function($type, $message)
+ {
+ Profiler::log($type, $message);
+ });
+
+ Event::listen('laravel.query', function($sql, $bindings, $time)
+ {
+ Profiler::query($sql, $bindings, $time);
+ });
+
+ // We'll attach the profiler to the "done" event so that we can easily
+ // attach the profiler output to the end of the output sent to the
+ // browser. This will display the profiler's nice toolbar.
+ Event::listen('laravel.done', function()
+ {
+ echo Profiler::render();
+ });
+ }
+
+}
diff --git a/laravel/profiling/template.blade.php b/laravel/profiling/template.blade.php
new file mode 100755
index 00000000..f434b8af
--- /dev/null
+++ b/laravel/profiling/template.blade.php
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+ @if (count($logs) > 0)
+
+
+ Type |
+ Message |
+
+ @foreach ($logs as $log)
+
+
+ {{ $log[0] }}
+ |
+
+ {{ print_r($log[1]) }}
+ |
+ @endforeach
+
+
+ @else
+
There are no log entries.
+ @endif
+
+
+
+ @if (count($queries) > 0)
+
+
+ Time |
+ Query |
+
+ @foreach ($queries as $query)
+
+
+ {{ $query[1] }}ms
+ |
+
+ {{ print_r($query[0]) }}
+ |
+
+ @endforeach
+
+ @else
+
There have been no SQL queries executed.
+ @endif
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file