<commit_before># PHP LIB
![image](/example/images/icon.png)

PHP LIB is a rapid development framework for PHP.
support PHP version 4/5

## Download
[Version 1.0](https://github.com/ateliee/php_lib/archive/master.zip)

## How To Use
Onry include "init_lib.php" file.
(setup init_lib.php)

### download file and include
``` php
include_once(dir(__FILE__)."/php_lib/init_lib.php");
```

### composer
```
    "require": {
        "ateliee/php_lib": "dev-master"
    }
```

## Example
* [Template Engine](#tpl)
* [Database Engine](#db)
* [Mail Engine](#mail)
* [Session Manager](#session)
* [Cookie Manager](#cookie)
* [FTP Maganer](#FTP)
* [File Manager](#file)
* [APNS Server Side](#apns)
* [GCM Server Side](#gcm)
* [Functions](#func)
* [Define](#define)

### <a name="tpl">Template Engine(class_templates.php)
* set variable(string,integer,double,associative array, array other)
* nest support.
* if,else,else if,foreach,for
* function support

``` php
$TPL = new class_template();
// load template file
$TPL->load("index.html");
// set template parts file
$TPL->setIncludeFile("Parts_File","parts.html");
// set template value
$value = array("name" => "sample");
$TPL->assign("human",$value);
$value = "test";
$TPL->assign("name",$value);

// set asssociative array
$TPL->assign_vars(array("test" => "string","ary" => array(1 => "test")));
// get template to string
$html_str = $TPL->get_display_template();
```

``` html(index.html)
<!-- set template parts file -->
<?include file='Parts_File'?>
<!-- 'name => sample' -->
<?foreach $human as $key => $item?>
<?$key?> => <?$item?>
<?/foreach?>
<!-- 'name is test' -->
name is <?$name?>
<!-- 'name is test' -->
<?if( $name == 'test' )?>
name is test
<?else?>
name is not test
<?/if?>

<!-- escape string -->
name is <?htmlentities($name)?>
name is <?escape($name)?>
name is <?htmlspecialchars($name)?>
name is <?escape_br($name)?>
name is <?quotes($name)?>
name is <?urlencode($name)?>
<!-- is_***() -->
name is <?is_array($name)?>
name is <?is_numeric($name)?>
name is <?is_string($name)?><commit_msg>bug fix<commit_after># PHP LIB
![image](/example/images/icon.png)

PHP LIB is a rapid development framework for PHP.
support PHP version 4/5

## Download
[Version 1.0](https://github.com/ateliee/php_lib/archive/master.zip)

## How To Use
Onry include "init_lib.php" file.
(setup init_lib.php)

### download file and include
``` php
include_once(dir(__FILE__)."/php_lib/init_lib.php");
```

### composer
```
    "require": {
        "ateliee/php_lib": "dev-master"
    }
```

## Example
* [Template Engine](#tpl)
* [Database Engine](#db)
* [Mail Engine](#mail)
* [Session Manager](#session)
* [Cookie Manager](#cookie)
* [FTP Maganer](#FTP)
* [File Manager](#file)
* [APNS Server Side](#apns)
* [GCM Server Side](#gcm)
* [Functions](#func)
* [Define](#define)

### <a name="tpl">Template Engine(class_templates.php)
* set variable(string,integer,double,associative array, array other)
* nest support.
* if,else,else if,foreach,for
* function support

``` php
$TPL = new class_template();
// load template file
$TPL->load("index.html");
// set template parts file
$TPL->setIncludeFile("Parts_File","parts.html");
// set template value
$value = array("name" => "sample");
$TPL->assign("human",$value);
$value = "test";
$TPL->assign("name",$value);

// set asssociative array
$TPL->assign_vars(array("test" => "string","ary" => array(1 => "test")));
// get template to string
$html_str = $TPL->get_display_template();
```

``` html(index.html)
<!-- set template parts file -->
<?include file='Parts_File'?>
<!-- 'name => sample' -->
<?foreach $human as $key => $item?>
<?$key?> => <?$item?>
<?/foreach?>
<!-- 'name is test' -->
name is <?$name?>
<!-- 'name is test' -->
<?if( $name == 'test' )?>
name is test
<?else?>
name is not test
<?/if?>

<!-- set value -->
<?set('test','sample')?>
display is sample : '<?$test?>'

<!-- escape string -->
name is <?htmlentities($name)?>
name is <?escape($name)?>
name is <?htmlspecialchars($name)?>
name is <?escape_br($name)?>
name is <?quotes($name)?>
name is <?urlencode($name)?>
<!-- is_***() -->
name is <?is_array($name)?>
name is <?is_numeric($name)?>
name is <?is_string($name)?>
{'fraction_non_alphanumeric': 0.23052959501557632, 'fraction_numerical': 0.0023963575365444525, 'mean_word_length': 5.040520984081042, 'pattern_counts': {'":': 4, '<': 56, '<?xml version=': 0, '>': 82, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '392000', 'n_tokens_mistral': 1493, 'n_tokens_neox': 1452, 'n_words': 367}