If Only I Knew That!

Webby things that could save you time

Archive for the ‘PHP’ Category

Codeception with Laravel 4

with one comment

To use codeception with Laravel 4

Install via composer

composer require "codeception/codeception:@stable"

Update composer if you add the require manually

composer update

Bootstrap codeception with the app directory path

codecept bootstrap app

Set the PhpBrowser url config in app/tests/acceptance.suite.yml

class_name:WebGuy modules:
    enabled:
        - PhpBrowser
        - WebHelper
    config:
        PhpBrowser:
            url: 'http://localhost:8888'

Move the codeception.yml file to the root directory otherwise you have to use the -c option to set the path on each call

mv app/codeception.yml codeception.yml

Adjust the paths in codeception.yml to reference app/tests

paths:
    tests: app/tests
    log: app/tests/_log
    data: app/tests/_data
    helpers: app/tests/_helpers

Test away

Written by admin

July 30th, 2013 at 8:30 pm

Posted in Laravel,PHP

Add vendor/bin to your path for use with composer

without comments

In your .bashrc file on OSX add

export PATH=vendor/bin:$PATH

Then you can call codeception if composer installed using the short version of just the name

codecept

instead of

vendor/bin/codecept

Written by admin

June 4th, 2013 at 9:18 am

Posted in Codeception,OSX,PHP

Quick tip: Codeigniter config for index.php when using .htaccess

without comments

Can across this the other day by dhorrigan on forrst.com

It checks for .htaccess file and if not found uses index.php

$config['index_page'] = is_file(FCPATH . '.htaccess') ? '' : 'index.php';

Written by daveganley

September 21st, 2010 at 5:08 pm

Posted in Codeigniter,PHP

Codeigniter 2.0 configurable profiler + some jQuery magic to show/hide

with 3 comments

The new CI 2.0 Profiler has configurable sections + 2 new additional sections (http_headers and config).

You’ll need to edit application/config/profiler.php

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Profiler Sections
| -------------------------------------------------------------------------
| This file lets you determine whether or not various sections of Profiler
| data are displayed when the Profiler is enabled.
| Please see the user guide for info:
|
|	http://codeigniter.com/user_guide/general/profiling.html
|
*/

$config['benchmarks'] 		= TRUE;
$config['get'] 				= TRUE;
$config['memory_usage'] 	= TRUE;
$config['post'] 			= TRUE;
$config['uri_string']		= TRUE;
$config['controller_info']	= TRUE;
$config['queries'] 			= TRUE;
$config['http_headers'] 	= TRUE;
$config['config'] 			= TRUE;

/* End of file profiler.php */
/* Location: ./application/config/profiler.php */

I previously used a modified version of MY_Profiler from dragffy.com. I modified it to add a button to the top of the page that would show or hide the profiler when needed and could also hide the profiler button totally.

Click to continue reading “Codeigniter 2.0 configurable profiler + some jQuery magic to show/hide”

Written by daveganley

May 4th, 2010 at 1:22 pm

Posted in Codeigniter,PHP

Quick and easy block commenting for testing

with 4 comments

To save time commenting and uncommenting during development we use a little trick with the comment block that allows us to add or remove a single character ‘\’ to comment/uncomment a block.

Uncommented

/* */
Block of code
/* */

Commented

/* *\/
Block of code
/* */

Quick and simple time saver

Written by daveganley

April 21st, 2010 at 4:25 pm

Posted in PHP

Powered by CDN Rewrites