PHP code example of jnbruno / forrest

1. Go to this page and download the library: Download jnbruno/forrest library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jnbruno / forrest example snippets


// Initialize with composer autoload
st([
    'database_type' => 'mysql',
    'database_name' => 'name',
    'server' => 'localhost',
    'username' => 'your_username',
    'password' => 'your_password',
    'charset' => 'utf8'
]);

//select($table,$join,$where)
$test->select('test',[
			'number as this_is_number',
			'text',
			'email'
			],
			[
			"LIMIT"	=> 5,
			"ORDER" => "number ASC"
]);
 


//table($tablename)
$result = $test ->table('test')
//add rules condition
				->rules([
							'number' 	 => " insert if valid
				->insert([
							'number' 	 => "1",
							'text'		 => "Forrest Test Text",
							'email'		 => "[email protected]"
						]);


$result = $test ->table('test')
				->rules([
							'number' 			=> "'		   		=> ""1",
								'text'		   => "                 Forrest Test Update                 ",
								'email'		   => "[email protected]"
						], ['test_id' => 1]);