Skip to content

Instantly share code, notes, and snippets.

rotexdegba / dev-server-router.php
Created Feb 1, 2021
Router script for the builtin PHP webserver to handle urls ending in dot something
View dev-server-router.php
// This script is intended to fix the php built-in server issue with urls that
// contain a .something at the end. The built-in server tries to always treat
// such urls as static assets when sometimes they are routes meant to be
// forwarded to the index.php. See below for more info:

Make sure you have installed debugbar via composer.

Copy this script to the root folder of you application and run it from there.

In your template file, which will usually be located in ./src/layout-templates, add the code below inside the head section of the template:

  <link rel="stylesheet" type="text/css" href="<?= s3MVC_MakeLink('/css/debugbar-css-assets.css'); ?>">
  <script type="text/javascript" src="<?= s3MVC_MakeLink('/js/debugbar-js-assets.js'); ?>"></script>
rotexdegba / dump-debugbar-public-assets.php
Last active Jan 28, 2021
Script for dumping debugbar css & js assets into the public folder of apps powered by
View dump-debugbar-public-assets.php
// For use in apps built with
// Copy script to the root folder of the project and run from there.
// Works with "maximebf/debugbar" version "^1.16
// This script copies the fonts folder from the debugbar composer vendor folder
// to the ./public/fonts folder. It also dumps all the css and js assets
// needed by debugbar into ./public/css/debugbar-css-assets.css and
// ./public/js/debugbar-js-assets.js respectively
rotexdegba / linux-disk-usage.php
Last active Apr 20, 2020
Linux Disk Usage PHP Script
View linux-disk-usage.php
include_once './vendor/autoload.php';
use jc21\CliTable;
use jc21\CliTableManipulator;
// copy script ( linux-disk-usage.php ) to a folder on your system and cd to that folder
// composer require jc21/clitable
// php linux-disk-usage.php
rotexdegba / rector.yaml
Last active Jan 21, 2020
A yaml file containing base Rector configuration setting to be used by the Rector tool on all my php projects
View rector.yaml
# rector.yaml
# - { resource: 'vendor/rector/rector/config/set/code-quality/code-quality.yaml' }
# - { resource: 'vendor/rector/rector/config/set/php/php52.yaml' }
# - { resource: 'vendor/rector/rector/config/set/php/php53.yaml' }
# - { resource: 'vendor/rector/rector/config/set/php/php54.yaml' }
# - { resource: 'vendor/rector/rector/config/set/php/php55.yaml' }
# - { resource: 'vendor/rector/rector/config/set/php/php56.yaml' }
# - { resource: 'vendor/rector/rector/config/set/php/php70.yaml' }
# - { resource: 'vendor/rector/rector/config/set/php/php71.yaml' }
rotexdegba / html5-input-type-number-2-decimal-places.html
Last active Jul 8, 2019
Html5 Input field for currency to 2 decimal places
View html5-input-type-number-2-decimal-places.html
<!DOCTYPE html>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<form method="post" id="add-edit-form" class="add-edit-form" enctype="multipart/form-data" action="http://localhost:8887/listing-types/edit/2">
<label for="name">Name<span style="color: red;"> *</span></label>
rotexdegba /
Created Jun 18, 2019
A list of changes in PHP 7.0+ all on one page

New Stuff in PHP 7.0

  1. Scalar type definitions: they come in two flavours: coercive (default) and strict. The following types for parameters can now be enforced (either coercively or strictly): strings (string), integers (int), floating-point numbers (float), and booleans (bool). They augment the other types introduced in PHP 5: class names, interfaces, array and callable.
    • Typed pass-by-reference Parameters gotcha: Declared types of reference parameters are checked on function entry, but not when the function returns, so after the function had returned, the argument's type may have changed. For example:
    function array_baz(array &$param)
    	$param = 1;
rotexdegba / object-has-get-property.php
Created Jun 28, 2018
Object Property Detection and Object Property Value Retrieval
View object-has-get-property.php
* A robust way of retrieving the value of a a specified property in
* an instance of a class.
* Works with \stdClass objects created from arrays with numeric key(s)
* (the value of the propertie(s) with numeric key(s) in such \stdClass
* objects will be retrieved by this function).
View old-collection.php
* A collection of Cfs_Model_Base_Record records.
* @package Cfs_Model
class Cfs_Model_Base_Collection extends Solar_Sql_Model_Collection {