PHP | Laravel | Web Scraping
A curated list of amazingly awesome PHP libraries, resources and shiny things.
PHP | Laravel | Web Scraping
A curated list of amazingly awesome PHP libraries, resources and shiny things.
<?php | |
// public/cliserver.php (router script) | |
if (php_sapi_name() !== 'cli-server') { | |
die('this is only for the php development server'); | |
} | |
if (is_file($_SERVER['DOCUMENT_ROOT'].'/'.$_SERVER['SCRIPT_NAME'])) { | |
// probably a static file... | |
return false; |
<?php | |
// this will read in all the speakers, sort them by date, then store in a file for use later | |
$speakerList = [ | |
'speaker-file', | |
]; | |
$speakers_all = []; | |
foreach($speakerList as $speaker) { | |
$speakers_all[$speaker] = include_once("./speakers/{$speaker}.php"); | |
$speakers_all[$speaker]['bullet-points'] = text2bullets($speakers_all[$speaker]['bullet-points']); |
<?php | |
/* | |
* USAGE: | |
* | |
* // this is where I define all my dependencies in case if they are not directly instantiable (resolvable) | |
* $deps = array( | |
* 'DependentClass' => array( | |
* 'depclass' => 'DependencyClass' | |
* ) | |
* ); |
<!doctype html> | |
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="de"> <![endif]--> | |
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="de"> <![endif]--> | |
<!--[if IE 8]> <html class="no-js lt-ie9" lang="de"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html class="no-js" lang="de"> <!--<![endif]--> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> |
<?php | |
/* | |
* Suitable for NON-HOSTED payment gateways wallets, funds, etc. | |
* | |
* You can also process HOSTED payment gateways like paypal, but you'll get a rediect URL at the end | |
* and you have to handle that depending on what client (android, ios) you're catering to. | |
* You can have the redirect URL open up in a web-view-client and collect payment. | |
* | |
**/ |
<?php | |
return array ( | |
0 => | |
array ( | |
'id' => 1, | |
'name' => 'Afghanistan', | |
'iso3' => 'AFG', | |
'iso2' => 'AF', | |
'phone_code' => '93', | |
'capital' => 'Kabul', |
<?php | |
return array ( | |
0 => | |
array ( | |
'id' => 3901, | |
'name' => 'Badakhshan', | |
'country_id' => 1, | |
'state_code' => 'BDS', | |
), | |
1 => |
import React, { | |
createContext, | |
useEffect, | |
useReducer | |
} from 'react'; | |
const lStorage = require('store'); // store.js library | |
export const CartContext = createContext(); |
import axios from 'axios'; | |
const addToast = (message: string, type: 'success' | 'error') => { | |
/// add logic to show toast | |
}; | |
// hook to know if there are network requests currently running | |
// and how many are running | |
export const useAxiosLoader = () => { | |
const [counter, setCounter] = React.useState(0); |