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.
- Host: GitHub
- URL: https://github.com/script47/easyphp
- Owner: Script47
- License: other
- Created: 2014-10-21T22:52:11.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-09-09T12:28:59.000Z (almost 11 years ago)
- Last Synced: 2025-01-06T09:21:29.695Z (over 1 year ago)
- Language: PHP
- Size: 210 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
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