An open API service indexing awesome lists of open source software.

https://github.com/script47/easyphp

A class containing various PHP functions to make a developers life easier.
https://github.com/script47/easyphp

Last synced: about 1 month ago
JSON representation

A class containing various PHP functions to make a developers life easier.

Awesome Lists containing this project

README

          

EasyPHP
=======

A class containing various PHP functions to make a developers life easier. Please feel free to add things to the class so we can make a better class.

Version: 1.1.4

Example
=======

I did simple test which involved a HTML text input and a submit button, the goal was to show the differences in not using EasyPHP class and using it.

Without EasyPHP

```php
if(isset($_POST['test'])) {
if(!isset($_POST['email']) || empty($_POST['email'])) {
echo "Email field empty.";
} else if(filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) == FALSE) {
echo "Email format incorrect.";
} else {
$emailAddress = htmlspecialchars(trim(filter_var($_POST['email'], FILTER_SANITIZE_EMAIL)));
echo "Your Email: " . $emailAddress . ". You will be redirected in 3 seconds.";
header("Refresh:3; URL=index.php");
}
}

```

Total Characters: 670 characters


Average Characters Per Sentence: 168

With EasyPHP

```php
if(isset($_POST['test'])) {
if(EasyPHP::isEmpty($_POST['email']) == FALSE) {
EasyPHP::message("Email field empty.", "error");
} else if(EasyPHP::validate($_POST['email'], "email") == FALSE) {
EasyPHP::message("Email format incorrect.", "error");
} else {
$emailAddress = EasyPHP::sanitize($_POST['email'], "email");
EasyPHP::message("Your Email: " . $emailAddress . ". You will be redirected in 3 seconds.", "message");
EasyPHP::redirect("index.php", "timed", 3);
}
}
```

Total Characters: 584 characters


Average Characters Per Sentence: 146

As the character count which I did shows EasyPHP has a difference of 86 characters and that is quite a big margin and coding is quicker and cleaner looking with EasyPHP.

Credits
=======

Developer: Script47