Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created an example project. Updated README to reflect the recent
namespacing changes and updated installation instructions as well. Fixed a problem in `ProfileLogRoute` if there is no db connection available.
- Loading branch information
Showing
20 changed files
with
1,186 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
vendor | ||
webroot/assets | ||
application/runtime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
run: | ||
cd webroot && php -S localhost:8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
/** | ||
* Controller is the customized base controller class. | ||
* All controller classes for this application should extend from this base class. | ||
*/ | ||
class Controller extends CController | ||
{ | ||
/** | ||
* @var string the default layout for the controller view. Defaults to '//layouts/column1', | ||
* meaning using a single column layout. See 'protected/views/layouts/column1.php'. | ||
*/ | ||
public $layout='//layouts/column1'; | ||
/** | ||
* @var array context menu items. This property will be assigned to {@link CMenu::items}. | ||
*/ | ||
public $menu=array(); | ||
/** | ||
* @var array the breadcrumbs of the current page. The value of this property will | ||
* be assigned to {@link CBreadcrumbs::links}. Please refer to {@link CBreadcrumbs::links} | ||
* for more details on how to specify this property. | ||
*/ | ||
public $breadcrumbs=array(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
require(dirname(__FILE__) . '/../../vendor/autoload.php'); | ||
|
||
return array( | ||
'basePath' => dirname(__FILE__).DIRECTORY_SEPARATOR.'..', | ||
'name' => 'Yii FirePHP Example', | ||
|
||
'preload' => array('log'), | ||
|
||
// autoloading model and component classes | ||
'import' => array( | ||
'application.models.*', | ||
'application.components.*', | ||
), | ||
|
||
'modules'=>array( | ||
|
||
), | ||
|
||
// application components | ||
'components' => array( | ||
'log' => array( | ||
'class' => 'CLogRouter', | ||
'routes' => array( | ||
// the default (file logger) | ||
array( | ||
'class' => 'CFileLogRoute', | ||
'levels' => 'error, warning', | ||
), | ||
// standard log route | ||
array( | ||
'class' => '\\SK\\Yii\\FirePHP\\LogRoute', | ||
'levels' => 'error, warning, info, trace', | ||
), | ||
// profile log route | ||
array( | ||
'class' => '\\SK\\Yii\\FirePHP\\ProfileLogRoute', | ||
'report' => 'summary', // or "callstack" | ||
), | ||
), | ||
), | ||
), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
class SiteController extends Controller | ||
{ | ||
public function actionIndex() | ||
{ | ||
// logging an INFO message | ||
Yii::log('This is an info message.', CLogger::LEVEL_INFO); | ||
|
||
// logging a WARNING message | ||
Yii::log("You didn't setup a profile, are you really a person?", CLogger::LEVEL_WARNING); | ||
|
||
// logging with a CATEGORY (categories are displayed as "labels" in FirePHP -- just an additional info text) | ||
Yii::log('Profile successfully created', CLogger::LEVEL_INFO, 'application.user.profiles'); | ||
|
||
// tracing simple text | ||
Yii::trace('Loading application.user.profiles.ninja', 'application.user.profiles'); | ||
|
||
// logging an ERROR | ||
Yii::log('We have successfully determined that you are not a person', | ||
CLogger::LEVEL_ERROR, 'Any category/label will work'); | ||
|
||
// If you need to log an array, you can use FirePHP's core methods | ||
FB::warn(array('a' => 'b', 'c' => 'd'), 'an.array.warning'); | ||
|
||
// Profiling | ||
|
||
Yii::beginProfile('rendering'); | ||
|
||
for ($i = 0; $i < 30; $i++) | ||
$this->runProfilingSampleLoop(); | ||
|
||
$this->render('index'); | ||
Yii::endProfile('rendering'); | ||
} | ||
|
||
private function runProfilingSampleLoop() | ||
{ | ||
Yii::beginProfile('dummy method'); | ||
for ($i = 0; $i < 100; $i++) { | ||
$a = 1; | ||
} | ||
Yii::endProfile('dummy method'); | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php /* @var $this Controller */ ?> | ||
<?php $this->beginContent('//layouts/main'); ?> | ||
<div id="content"> | ||
<?php echo $content; ?> | ||
</div><!-- content --> | ||
<?php $this->endContent(); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php /* @var $this Controller */ ?> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<meta name="language" content="en" /> | ||
|
||
<!-- blueprint CSS framework --> | ||
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/screen.css" media="screen, projection" /> | ||
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/print.css" media="print" /> | ||
<!--[if lt IE 8]> | ||
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/ie.css" media="screen, projection" /> | ||
<![endif]--> | ||
|
||
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/main.css" /> | ||
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/form.css" /> | ||
|
||
<title><?php echo CHtml::encode($this->pageTitle); ?></title> | ||
</head> | ||
|
||
<body> | ||
|
||
<div class="container" id="page"> | ||
|
||
<div id="header"> | ||
<div id="logo"><?php echo CHtml::encode(Yii::app()->name); ?></div> | ||
</div><!-- header --> | ||
|
||
<div id="mainmenu"> | ||
<?php $this->widget('zii.widgets.CMenu', array( | ||
'items'=>array( | ||
array('label'=>'Home', 'url'=>array('/site/index')), | ||
), | ||
)); ?> | ||
</div><!-- mainmenu --> | ||
<?php if(isset($this->breadcrumbs)):?> | ||
<?php $this->widget('zii.widgets.CBreadcrumbs', array( | ||
'links' => $this->breadcrumbs, | ||
)); ?><!-- breadcrumbs --> | ||
<?php endif?> | ||
|
||
<?php echo $content; ?> | ||
|
||
<div class="clear"></div> | ||
|
||
<div id="footer"> | ||
Copyright © <?php echo date('Y'); ?> by Shiki.<br/> | ||
All Rights Reserved.<br/> | ||
<?php echo Yii::powered(); ?> | ||
</div><!-- footer --> | ||
|
||
</div><!-- page --> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
/* @var $this SiteController */ | ||
|
||
$this->pageTitle=Yii::app()->name; | ||
?> | ||
|
||
<h1>Welcome to <i><?php echo CHtml::encode(Yii::app()->name); ?></i></h1> | ||
|
||
<p>Congratulations! You have successfully created your Yii application.</p> | ||
|
||
<p>You may change the content of this page by modifying the following two files:</p> | ||
<ul> | ||
<li>View file: <code><?php echo __FILE__; ?></code></li> | ||
<li>Layout file: <code><?php echo $this->getLayoutFile('main'); ?></code></li> | ||
</ul> | ||
|
||
<p>For more details on how to further develop this application, please read | ||
the <a href="http://www.yiiframework.com/doc/">documentation</a>. | ||
Feel free to ask in the <a href="http://www.yiiframework.com/forum/">forum</a>, | ||
should you have any questions.</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"repositories": [ | ||
{ "type": "vcs", "url": "https://github.com/shiki/yii-firephp.git" } | ||
], | ||
"require": { | ||
"yiisoft/yii": ">= 1.1.14", | ||
"shiki/yii-firephp": "dev-master" | ||
} | ||
} |
Oops, something went wrong.