From 6daa051ef754e98641ec0acf217e4a6d8faaf65b Mon Sep 17 00:00:00 2001 From: Sebastiaan Lauwers Date: Sun, 23 Mar 2008 23:41:06 +0100 Subject: [PATCH] New version submitted by TomB We've upgraded to version 2.1.1 Check the changelog for all the fixes and updates --- Documentation/database/active_record.html | 288 +++++++- Documentation/database/configuration.html | 31 +- Documentation/database/queries.html | 22 + Documentation/database/utilities.html | 223 +++++- Documentation/general/profiling.html | 95 +++ Documentation/index.html | 12 +- Documentation/libraries/benchmark.html | 17 - Documentation/libraries/config.html | 45 +- Documentation/libraries/flickr.html | 134 ++++ Documentation/libraries/input.html | 119 ++-- Documentation/libraries/language.html | 14 - Documentation/libraries/loader.html | 70 -- Documentation/libraries/output.html | 35 +- Documentation/libraries/pagination.html | 14 - Documentation/libraries/parser.html | 198 ++++++ Documentation/libraries/table.html | 44 -- Documentation/libraries/unit_test.html | 214 ++++++ Documentation/libraries/uri.html | 64 +- Documentation/libraries/zip.html | 37 - Documentation/utilities/array.html | 120 ++++ Documentation/utilities/directory.html | 123 ++++ Documentation/utilities/form.html | 83 +++ Source/application/config/autoload.php | 6 + Source/application/config/database.php | 18 +- Source/application/config/routing.php | 2 +- Source/application/errors/error.php | 2 +- Source/application/errors/error_404.php | 2 +- Source/application/errors/error_database.php | 2 +- Source/application/errors/error_php.php | 2 +- Source/carbon/core/Base.php | 6 +- Source/carbon/core/Carbon_Core.php | 56 +- Source/carbon/core/Common.php | 45 +- Source/carbon/database/Database.php | 53 +- Source/carbon/database/Database_active_record.php | 662 +++++++++++++++-- Source/carbon/database/Database_cache.php | 2 +- Source/carbon/database/Database_driver.php | 210 ++++-- Source/carbon/database/Database_result.php | 39 + Source/carbon/database/Database_utility.php | 176 ++++- .../carbon/database/drivers/mysql/mysql_driver.php | 124 +++- .../database/drivers/mysql/mysql_utility.php | 178 ++++- Source/carbon/languages/english/database_lang.php | 32 +- Source/carbon/languages/english/profiler_lang.php | 25 + .../carbon/languages/english/scaffolding_lang.php | 2 +- Source/carbon/languages/english/unit_test_lang.php | 31 + Source/carbon/libraries/Benchmark.php | 4 +- Source/carbon/libraries/Config.php | 36 +- Source/carbon/libraries/Controller.php | 26 +- Source/carbon/libraries/Exception.php | 14 +- Source/carbon/libraries/Extensions.php | 24 +- Source/carbon/libraries/Flickr.php | 159 +++++ Source/carbon/libraries/Input.php | 103 ++- Source/carbon/libraries/Language.php | 14 +- Source/carbon/libraries/Loader.php | 126 ++-- Source/carbon/libraries/Logging.php | 22 +- Source/carbon/libraries/Model.php | 8 +- Source/carbon/libraries/Output.php | 91 ++- Source/carbon/libraries/Pagination.php | 61 +- Source/carbon/libraries/Parser.php | 108 +++ Source/carbon/libraries/Profiler.php | 247 +++++++ Source/carbon/libraries/Router.php | 618 ++++++---------- Source/carbon/libraries/Table.php | 34 +- Source/carbon/libraries/Unit_test.php | 218 ++++++ Source/carbon/libraries/Uri.php | 195 ++++- Source/carbon/libraries/Zip.php | 20 +- Source/carbon/scaffolding/Scaffolding.php | 2 +- Source/carbon/utilities/array_utility.php | 38 + Source/carbon/utilities/directory_utility.php | 39 + Source/carbon/utilities/filesystem_utility.php | 7 +- Source/carbon/utilities/form_utility.php | 635 ++++++++++------- Source/carbon/utilities/url_utility.php | 785 +++++++++++---------- Source/carbon/utilities/uuid_utility.php | 19 +- Source/carbon/utilities/xml_utility.php | 53 +- Source/index.php | 13 +- changelog.txt | 139 ++-- 74 files changed, 5443 insertions(+), 2092 deletions(-) create mode 100644 Documentation/general/profiling.html create mode 100644 Documentation/libraries/flickr.html create mode 100644 Documentation/libraries/parser.html create mode 100644 Documentation/libraries/unit_test.html create mode 100644 Documentation/utilities/array.html create mode 100644 Documentation/utilities/directory.html create mode 100644 Source/carbon/languages/english/profiler_lang.php create mode 100644 Source/carbon/languages/english/unit_test_lang.php create mode 100644 Source/carbon/libraries/Flickr.php create mode 100644 Source/carbon/libraries/Parser.php create mode 100644 Source/carbon/libraries/Profiler.php rewrite Source/carbon/libraries/Router.php (65%) create mode 100644 Source/carbon/libraries/Unit_test.php create mode 100644 Source/carbon/utilities/array_utility.php create mode 100644 Source/carbon/utilities/directory_utility.php rewrite Source/carbon/utilities/form_utility.php (88%) rewrite Source/carbon/utilities/url_utility.php (88%) rewrite Source/carbon/utilities/xml_utility.php (62%) rewrite changelog.txt (96%) diff --git a/Documentation/database/active_record.html b/Documentation/database/active_record.html index 4847e41..d2ffc4a 100644 --- a/Documentation/database/active_record.html +++ b/Documentation/database/active_record.html @@ -98,13 +98,13 @@
-

$this->db->getwhere()

+

$this->db->getw_here()

This method is identical to the above one except that it allows you to add a 'where' clause to the statement, instead of using $this->db->where().

- $query = $this->db->getwhere('some_table', array('id' => $id), $limit, $offset); + $query = $this->db->get_where('some_table', array('id' => $id), $limit, $offset);

The where() method is outlined below.

@@ -124,6 +124,77 @@

If you are selecting all (*) from a table, you can omit this method.

+ +

$this->db->select() accepts an optional second parameter. If this parameter is set to false, CarbonPHP will + try to not protect your field or table names with backticks. This is useful if you need a compound select statement.

+ + +
+

$this->db->select_max()

+ +

This writes a "SELECT MAX(field)" portion of your query. You can optionally include a second + parameter to rename the resulting field.

+ +
+ $this->db->select_max('age');
+ $query = $this->db->get('members');
+ // gives SELECT MAX(age) as age FROM members
+
+ $this->db->select_max('age', 'member_age');
+ $query = $this->db->get('members');
+ // gives SELECT MAX(age) as member_age FROM members +
+
+ +
+

$this->db->select_min()

+ +

This writes a "SELECT MIN(field)" portion of your query. You can optionally include a second + parameter to rename the resulting field.

+ +
+ $this->db->select_min('age');
+ $query = $this->db->get('members');
+ // gives SELECT MIN(age) as age FROM members
+
+ $this->db->select_min('age', 'member_age');
+ $query = $this->db->get('members');
+ // gives SELECT MIN(age) as member_age FROM members +
+
+ +
+

$this->db->select_avg()

+ +

This writes a "SELECT AVG(field)" portion of your query. You can optionally include a second + parameter to rename the resulting field.

+ +
+ $this->db->select_avg('age');
+ $query = $this->db->get('members');
+ // gives SELECT AVG(age) as age FROM members
+
+ $this->db->select_avg('age', 'member_age');
+ $query = $this->db->get('members');
+ // gives SELECT AVGage) as member_age FROM members +
+
+ +
+

$this->db->select_sum()

+ +

This writes a "SELECT SUM(field)" portion of your query. You can optionally include a second + parameter to rename the resulting field.

+ +
+ $this->db->select_sun('age');
+ $query = $this->db->get('members');
+ // gives SELECT SUM(age) as age FROM members
+
+ $this->db->select_min('age', 'member_age');
+ $query = $this->db->get('members');
+ // gives SELECT SUM(age) as member_age FROM members +
@@ -247,19 +318,67 @@
-

$this->db->orwhere()

+

$this->db->or_where()

This method is identical to the above one, except that multiple instances are joined by OR.

$this->db->where('name !=', $name);
- $this->db->orwhere('id >', $id);
+ $this->db->or_where('id >', $id);

// This produces: WHERE name != 'John' OR id > 500
+

$this->db->where_in()

+ +

This generates a WHERE field IN ('item', 'item') SQL query joined with an AND if appropriate.

+ +
+ $names = array('Frank', 'Tom', 'Bob');
+ $this->db->where_in('username', $names);
+ // gives AND WHERE username IN ('Frank', 'Tom', 'Bob'); +
+
+ +
+

$this->db->or_where_in()

+ +

This generates a OR WHERE field IN ('item', 'item') SQL query joined with an OR if appropriate.

+ +
+ $names = array('Frank', 'Tom', 'Bob');
+ $this->db->or_where_in('username', $names);
+ // gives OR WHERE username IN ('Frank', 'Tom', 'Bob'); +
+
+ +
+

$this->db->where_not_in()

+ +

This generates a WHERE field NOT IN ('item', 'item') SQL query joined with an AND if appropriate.

+ +
+ $names = array('Frank', 'Tom', 'Bob');
+ $this->db->where_not_in('username', $names);
+ // gives WHERE username NOT IN ('Frank', 'Tom', 'Bob'); +
+
+ +
+

$this->db->or_where_not_in()

+ +

This generates a OR WHERE field NOT IN ('item', 'item') SQL query joined with an OR if appropriate.

+ +
+ $names = array('Frank', 'Tom', 'Bob');
+ $this->db->or_where_not_in('username', $names);
+ // gives OR WHERE username NOT IN ('Frank', 'Tom', 'Bob'); +
+
+ +

$this->db->like()

This method enables you to generate LIKE clauses, these are useful for doing searches.

@@ -282,6 +401,20 @@
// This produces: WHERE title LIKE '%match%' AND body LIKE '%match%'
+ +

If you want to control where the wildcard (%) is placed, you can use an optioanl third argument. + Your options are 'before', 'after', and 'both'. The default is 'both'.

+ +
+ $this->db->like('title', 'match', 'before');
+ // gives WHERE title LIKE '%match'
+
+ $this->db->like('title', 'match', 'after');
+ // gives WHERE title LIKE 'match%'
+
+ $this->db->like('title', 'match', 'both');
+ // gives WHERE title LIKE '%match%' +
  • @@ -299,20 +432,43 @@
    -

    $this->db->orlike()

    +

    $this->db->or_like()

    This method is identical to the above one except that multiple calls will be joined with OR.

    $this->db->like('title', $match);
    - $this->db->orlike('body', $match);
    + $this->db->or_like('body', $match);

    // This produces: WHERE title LIKE '%match%' OR body LIKE '%match%'
    -

    $this->db->groupby()

    +

    $this->db->not_like()

    + +

    This function is identical to like() except that it generates NOT LIKE statements.

    + +
    + $this->db->not_like('title', 'match');
    + // gives WHERE title NOT LIKE %match% +
    +
    + +
    +

    $this->db->or_not_like()

    + +

    This function is identical to not_like() except that multiple instances are joined by OR.

    + +
    + $this->db->like('title', 'match');
    + $this->db->or_not_like('body', 'match');
    + // gives WHERE title LIKE %match% OR body NOT LIKE %match% +
    +
    + +
    +

    $this->db->group_by()

    This method allows you to write GROUP BY parts of your queries.

    @@ -332,6 +488,18 @@
    +

    $this->db->distinct()

    + +

    Adds the DISTINCT keyword to a query.

    + +
    + $this->db->distinct();
    + $this->db->get('table');
    + // gives SELECT DISTINCT * FROM table +
    +
    + +

    $this->db->having()

    This method allows you to write the HAVING parts of your queries.

    @@ -352,14 +520,20 @@
    -

    $this->db->orderby()

    +

    $this->db->or_having()

    + +

    Identical to having() only it separates multiple clauses with OR.

    +
    + +
    +

    $this->db->order_by()

    This method lets you set an ORDER BY clause. The first parameter contains the name of the column you would like to order by. The second parameter allows you to set the direction of the result. The options are asc, desc, or RAND().

    - $this->db->orderby('title', 'desc');
    + $this->db->order_by('title', 'desc');

    // This produces: ORDER BY title DESC
    @@ -367,7 +541,7 @@

    You can also pass your own string in the first parameter.

    - $this->db->orderby('title desc, name asc');
    + $this->db->order_by('title desc, name asc');

    // This produces: ORDER BY title DESC, name ASC
    @@ -394,6 +568,23 @@
    +

    $this->db->count_all_results()

    + +

    This allows you to determine the number of rows in a given Active Record query. Queries will accept + Active Record restrictors such as where(), or_where(), like(), and or_like(), etc.

    + +
    + echo $this->db->count_all_results('my_table');
    + // gives an integer like 25
    +
    + $this->db->like('title', 'match');
    + $this->db->from('my_table');
    + echo $this->db->count_all_results();
    + // gives an integer like 17 +
    +
    + +

    $this->db->count_all()

    This method allows you to determine the number of rows in the table.

    @@ -600,6 +791,33 @@
    +

    $this->db->empty_table()

    + +

    This generates a delete SQL query and runs the query.

    + +
    + $this->db->empty_table('my_table');
    + // gives DELETE FROM my_table +
    +
    + +
    +

    $this->db->truncate()

    + +

    This generates a truncate SQL query and runs the query.

    + +
    + $this->db->from('my_table');
    + $this->db->truncate();
    + // or
    + $this->db->truncate('my_table');
    + // gives TRUNCATE my_table +
    + +

    Note: if the TRUNCATE command is not available, truncate() will execute as DELETE FROM table.

    +
    + +

    Method Chaining

    Method chaining allows you to simplify your syntax by connecting multiple methods.

    @@ -610,6 +828,56 @@ $query = $this->db->get();
    + +
    +

    Active Record Caching

    + +

    While this is not true caching, Active Record enables you to save (or "cache") certain parts of your queries for reuse. + Normally when an Active Record call is completed, all stored information is reset for the next call. With caching, you can + prevent this reset, and reuse the information.

    + +

    Cached calls are cumulative. If you make two cached calls of select(), and then two uncached calls to select() + this will result in four select() calls. There are three caching methods available.

    +
    + +
    +

    $this->db->start_cache()

    + +

    This method must be called to begin Active Record caching. All Active Record queries of the correct type (below are the + supported queries) are stored for reuse later.

    +
    + +
    +

    $this->db->stop_cache()

    + +

    This method can be called to stop Active Record caching.

    +
    + +
    +

    $this->db->flush_cache()

    + +

    This method deletes all items from the Active Record cache.

    + +
    + $this->db->start_cache();
    + $this->db->select('field1');
    + $this->db->stop_cache();
    + $this->db->get('tablename');
    + // give SELECT `field1` FROM (`tablename`)
    +
    + $this->db->select('field2');
    + $this->db->get('tablename');
    + // gives SELECT `field1`, `field2` FROM (`tablename`)
    +
    + $this->db->flush_cache();
    +
    + $this->db->select('field2');
    + $this->db->get('tablename');
    + // gives SELECT `field2` FROM (`tablename`) +
    + +

    Note: the following commands can be cached: select, from, join, where, like, group_by, having, order_by, and set.

    +
    diff --git a/Documentation/database/configuration.html b/Documentation/database/configuration.html index 92d45a0..e21d081 100644 --- a/Documentation/database/configuration.html +++ b/Documentation/database/configuration.html @@ -72,9 +72,12 @@ $database['default']['database'] = 'database_name';
    $database['default']['dbdriver'] = 'mysql';
    $database['default']['dbprefix'] = '';
    - $database['default']['active_r'] = true;
    $database['default']['pconnect'] = true;
    - $database['default']['db_debug'] = false; + $database['default']['db_debug'] = false;
    + $database['default']['cache_on'] = false;
    + $database['default']['cachedir'] = '';
    + $database['default']['char_set'] = 'utf8';
    + $database['default']['dbcollat'] = 'utf8_general_ci';

    The reason a multi-dimensional array is used is that it allows more than one set of database connection @@ -87,9 +90,12 @@ $database['test']['database'] = 'database_name';
    $database['test']['dbdriver'] = 'mysql';
    $database['test']['dbprefix'] = '';
    - $database['test']['active_r'] = true;
    $database['test']['pconnect'] = true;
    - $database['test']['db_debug'] = false; + $database['test']['db_debug'] = false;
    + $database['test']['cache_on'] = false;
    + $database['test']['cachedir'] = '';
    + $database['test']['char_set'] = 'utf8';
    + $database['test']['dbcollat'] = 'utf8_general_ci';

    To globally tell CarbonPHP which connection settings to use you just set the $active_group @@ -101,6 +107,18 @@

    +

    Active Record

    + +

    The Active Record class is globally enabled or disabled by setting the $active_record variable in the database + configuration file to true or false. If you are not using the active record class, setting it to false will use fewer resources + when the database classes are initialised.

    + +
    + $active_record = true; +
    +
    + +

    Configuration Options

      @@ -112,7 +130,10 @@
    • dbpreifx - the optional table prefix which will be added when running active record queries.
    • pconnect - the option to use a persistant database connection.
    • db_debug - the option to show database errors or not.
    • -
    • active_r - the option whether to load the actie record class.
    • +
    • cache_on - the option whether database query caching is enabled.
    • +
    • cachedir - the absolute path to the directory to use for query caching.
    • +
    • char_set - the character set used in communicating with the database.
    • +
    • dbcollat - the character collation used in communication with the database.
    • port - the database port number, only used for the postgre driver.
    diff --git a/Documentation/database/queries.html b/Documentation/database/queries.html index fa47bb9..fa500bb 100644 --- a/Documentation/database/queries.html +++ b/Documentation/database/queries.html @@ -91,6 +91,28 @@
    +

    Adding Database Prefixes Manually

    + +

    If you have configured a database prefix and would like to add it in manually, you can use the following.

    + +
    + $this->db->dbprefix('tablename'); + // outputs prefix_tablename +
    +
    + +
    +

    Protecting Identifiers

    + +

    In many databases it is adviable for you to protect table and field names, for example with backticks in MySQL. The Active Record class + automatically protects its queries. If you need to manually protect an identifier you can use the following.

    + +
    + $this->db->protect_identifiers('table_name'); +
    +
    + +

    Escaping SQL Queries

    It is very good practice to escape your data that is being inserted into a database. CarbonPHP provides diff --git a/Documentation/database/utilities.html b/Documentation/database/utilities.html index c7064f7..9e5d035 100644 --- a/Documentation/database/utilities.html +++ b/Documentation/database/utilities.html @@ -81,34 +81,6 @@

    -

    $this->dbutil->create_database('db_name')

    - -

    This allows you to create a database as specified in the first parameter. It will return true or false - based on its success or failure.

    - -
    - if ($this->dbutil->create_database('some_database'))
    - {
    -     echo 'Database has been created.';
    - } -
    -
    - -
    -

    $this->dbutil->drop_database('db_name')

    - -

    This allows you to drop a database as specified in the first parameter. It will return true or false - based on its success or failure.

    - -
    - if ($this->dbutil->drop_database('some_database'))
    - {
    -     echo 'Database has been dropped.';
    - } -
    -
    - -

    $this->dbutil->list_databases()

    This method returns an array of database names.

    @@ -269,6 +241,201 @@
  • 'newline' - default value "\n" - Type of newline to use in your SQL.
  • + +
    +

    $this->dbutil->create_database('db_name')

    + +

    This allows you to create a database as specified in the first parameter. It will return true or false + based on its success or failure.

    + +
    + if ($this->dbutil->create_database('some_database'))
    + {
    +     echo 'Database has been created.';
    + } +
    +
    + +
    +

    $this->dbutil->drop_database('db_name')

    + +

    This allows you to drop a database as specified in the first parameter. It will return true or false + based on its success or failure.

    + +
    + if ($this->dbutil->drop_database('some_database'))
    + {
    +     echo 'Database has been dropped.';
    + } +
    +
    + +
    +

    Creating and Dropping Tables

    + +

    There are several things you may wisth to do when creating tables. Add fields, + add keys to the table, alter columns. CarbonPHP provides a mechanism for this.

    +
    + +
    +

    Adding Fields

    + +

    Fields are created via an associative array. Within the array you must include a 'type' key + that relates to the datatype of the field. For example, INT, VARCHAR, TEXT, etc. + Many datatypes (for example VARCHAR) also require a 'constraint' key.

    + +
    + $fields = array(
    +     'users' => array(
    +         'type' => 'varchar',
    +         'constraint' => '100'
    +     );
    + );
    + // will translate to 'users VARCHAR(100)' when the field is added. +
    + +

    Additionally the following key/values can be used:

    + + + +
    + $fields = array(
    +     'blog_id' => array(
    +         'type' => 'INT',
    +         'constraint' => '5',
    +         'unsigned' => true,
    +         'auto_increment' =>true
    +     ),
    +     'blog_title' => array(
    +         'type' => 'VARCHAR',
    +         'constraint' => '100'
    +     ),
    +     'blog_author' => array(
    +         'type' => 'VARCHAR',
    +         'constraint' => '100',
    +         'default' => 'BlogOwner'
    +     )
    +     'blog_description' => array(
    +         'type' => 'TEXT',
    +         'null' => true
    +     )
    + ); +
    + +

    After the fields have been defined, they can be added using $this->dbutils->add_fields($fields); + followed by a call to the create_table() method.

    + +

    $this->dbutils->add_field()

    + +

    The add fields method will accept the above array.

    + +

    Passing Strings as Fields

    + +

    If you know exactly how you want a field to be created, you can pass the string into + the field definitions with add_field().

    + +
    + $this->dbutils->add_field("label varchar(100) NOT NULL DEFAULT 'default label'"); +
    + +

    Note: multiple calls to add_field() are cumulative.

    + +

    Creating an ID Field

    + +

    There is a special exception for creating ID fields. A field with type id will automatically be + assignment as an INT(9) auto_incrementing primary key.

    + +
    + $this->dbutils->add_field('id'); + // creates id INT(9) NOT NULL AUTO_INCREMENT +
    + +

    Adding Keys

    + +

    Generally speaking, you'll want your table to have keys. This is accomplished with + $this->dbutils->add_key('field'). An optional parameter set to true will make it + a primary key. Note that add_key() must be followed by a call to create_table().

    + +
    + $this->dbutils->add_key('blog_id', true);
    + // gives PRIMARY KEY (blog_id)
    +
    + $this->dbutils->add_key('blog_name');
    + // gives KEY (blog_name) +
    + +

    Creating a Table

    + +

    After fields and keys have been declared, you can create a new table with

    + +
    + $this->dbutils->create_table('table_name');
    + // gives CREATE TABLE table_name; +
    + +

    An optional second parameter set to true adds an 'IF NOT EXISTS' clause into the definition.

    + +
    + $this->dbutil->create_table('table_name', true);
    + // give CREATES TABLE IF NOT EXISTS table_name +
    + +

    Dropping a Table

    + +

    Executes a DROP TABLE SQL query.

    + +
    + $this->dbutil->drop_table('table_name');
    + // gives DROP TABLE IF EXISTS table_name +
    +
    + +
    +

    Modifying Tables

    + +

    $this->dbutils->add_column()

    + +

    The add_column() method is used to modify an existing table. It accepts the same field + array as above, and can be used for an unlimited number of additional fields.

    + +
    + $fields = array(
    +     'preferences' => array('type' => 'TEXT')
    + );
    + $this->dbutils->add_column('table_name', $fields);
    + // gives ALTER TABLE table_name ADD preferences TEXT +
    + +

    $this->dbutils->drop_column()

    + +

    Used to remove a column from a table.

    + +
    + $this->dbutil->drop_column('table_name', 'column_to_drop'); +
    + +

    $this->dbutils->modify_column()

    + +

    The usage of the method is identifcal to add_column() except it alters an existing column rather + than adding a new one. In order to use it you must add a 'name' key into the field defining array.

    + +
    + $fields = array(
    +     'old_name' => array(
    +         'name' => 'new_name',
    +         'type' => 'TEXT'
    +     )
    + );
    + $this->dbutil->modify_column('table_name', $fields);
    + // gives ALTER TABLE table_name CHANGE old_name new_name TEXT +
    +
    diff --git a/Documentation/general/profiling.html b/Documentation/general/profiling.html new file mode 100644 index 0000000..545498a --- /dev/null +++ b/Documentation/general/profiling.html @@ -0,0 +1,95 @@ + + + CarbonPHP Documentation + + + + +
    +

    Profiling Your Web Application

    + +

    The profiler class displays benchmark results, queries that have been run, $_GET, and $_POST data at + the bottom of your pages. The information can help developement in order to optimise and debug your + web applications.

    + +

    Note: this class does not need to be initialised, it is loaded by the output class if profiling + is enabled.

    +
    + +
    +

    Enabling the Profiler

    + +

    To enable the profiler you can place the following line anywhere within your controller methods.

    + +
    + $this->output->enable_profiler(true); +
    + +

    When enabled a report will be generated and appended to your pages. To disable the profiler you can + use the following line.

    + +
    + $this->output->enable_profiler(false); +
    +
    + +
    +

    Setting Benchmark Points

    + +

    In order for the profiler to compile and display your benchmarks data you must name your mark points + using a specific syntax. This information is explained in the benchmark library page.

    +
    + + + diff --git a/Documentation/index.html b/Documentation/index.html index 1341e61..382d15d 100644 --- a/Documentation/index.html +++ b/Documentation/index.html @@ -86,12 +86,12 @@
  • CarbonPHP Libraries
  • Creating Your Own Libraries
  • Creating Core Libraries
  • -
  • Extensions - Extending CarbonPHP
  • Autoloading
  • Scaffolding
  • URI Routing
  • Error Handling
  • Caching
  • +
  • Profiling Your Web Application
  • Security
  • @@ -104,18 +104,14 @@ @@ -149,6 +145,8 @@

    These are utilities that provide simple procedural functions for you to use.