1. Go to this page and download the library: Download andrewmead/wordpress-proper 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/ */
andrewmead / wordpress-proper example snippets
use Proper\Number;
Number::abbreviate(654201); // 654.2K
use Proper\Periodic;
if (Periodic::check('verify_geo_database_file', 'PT30M')) {
// Run some code every 30 minutes
}
// Define the period using a string
$should_verify = Periodic::check('verify_geo_database_file', 'PT3S');
// Define the period using a DateInterval
$interval = new DateInterval('PT3S');
$should_verify = Periodic::check('verify_geo_database_file', $interval);
use Proper\Number;
Number::abbreviate(1260000); // 1.3M
Number::abbreviate(133800); // 133.8K
// Round off decimals
Number::abbreviate(133800, true); // 134K
use Proper\Timezone;
Timezone::site_timezone(); // new DateTimeZone('America/New_York')
use Proper\Timezone;
Timezone::site_offset(); // "-04:00"
use Proper\Timezone;
Timezone::site_offset_in_hours(); // -4
use Proper\Timezone;
Timezone::site_offset_in_seconds(); // -14400
use Proper\Timezone;
Timezone::utc_timezone(); // Will always return new DateTimeZone('UTC');
use Proper\Timezone;
Timezone::utc_offset(); // Will always return "+00:00"
use Proper\Timezone;
Timezone::utc_offset_in_hours(); // Will always return 0
use Proper\Timezone;
Timezone::utc_offset_in_seconds(); // Will always return 0
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.