A list of amazingly awesome PHP libraries, resources and shiny things.
- Composer/Packagist - A package and dependency manager.
- Composer Installers - A multi framework Composer library installer.
A list of amazingly awesome PHP libraries, resources and shiny things.
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | |
<title>Bootstrap 101 Template</title> | |
<!-- Latest compiled and minified CSS --> |
$array = array( | |
array( | |
"type" => "a", | |
"value" => 1 | |
), | |
array( | |
"type" => "a", | |
"value" => 2 | |
), | |
array( |
<?php | |
// Add a new interval of a week | |
// See http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules | |
add_filter( 'cron_schedules', 'myprefix_add_weekly_cron_schedule' ); | |
function myprefix_add_weekly_cron_schedule( $schedules ) { | |
$schedules['weekly'] = array( | |
'interval' => 604800, // 1 week in seconds | |
'display' => __( 'Once Weekly' ), | |
); |
Sometimes it is needed to manipulate private and protected properties of instances. The common way to do this is to manipule the visibility of the targeted properties using class reflection, but there is a more memory and performance efficient way to accomplish this task.
At first injectors are not standardized nor described along design patterns, i choose Injectors as the name for this mechanic because of their major usage. The explicit technical name could be: IO-Adapters for invisible properties. Injectors do use closure binding with a explicit class scope. So, whatever you want to modify does require knowledge about the implementation details of the targeted parameters, as you should have when directly using closure binding.
<?php | |
$username = 'redeye007'; | |
$password = 'redeye123'; | |
$id= 1780; | |
// the standard end point for posts in an initialised Curl | |
$process = curl_init('http://wordpress-300829-921065.cloudwaysapps.com/wp-json/wp/v2/posts'); | |
// create an array of data to use, this is basic - see other examples for more complex inserts | |
$data = array('slug' => 'rest_insert' , 'title' => 'new REST API insert update 258' , 'content' => ' newThe content of our stuff update post 2sdsd', 'excerpt' => 'smaller' ); | |
$data_string = json_encode($data); |
<?php | |
$data = array('slug' => 'rest_insert' , 'title' => 'wp remote API insert wp update 1817' , 'content' => 'The content of our stuff update post 2', 'excerpt' => 'smaller' ); | |
$data_string = json_encode($data); | |
$id= 1827; | |
$args = array( | |
'headers' => array( | |
//'Authorization' => 'Bearer ' . $token | |
'Authorization' => 'Basic ' . base64_encode( $username . ':' . $password ), | |
'Content-Type' => 'application/json', | |
), |
<?php | |
// Fetching JSON | |
$req_url = 'https://api.exchangerate-api.com/v4/latest/USD'; | |
//$req_url = 'https://api.exchangerate-api.com/v4/latest/EUR'; | |
$response_json = file_get_contents($req_url); | |
// Continuing if we got a result | |
if(false !== $response_json) { | |
// Try/catch for json_decode operation |
<?php | |
use Elementor\Controls_Manager; | |
use Elementor\Element_Base; | |
use Elementor\Core\Files\CSS\Post; | |
use Elementor\Core\DynamicTags\Dynamic_CSS; | |
// Exit if accessed directly | |
if (!defined('ABSPATH')) { | |
exit; |
<?php | |
namespace ElementorControls; | |
if (!defined('ABSPATH')) exit; // Exit if accessed directly | |
class Elementor_Custom_Controls { | |
public function includes() { | |
require_once(plugin_dir_path(__FILE__).'inc/elementor/image-selector-control.php'); | |
} |