Despite Google I couldn't find this. How to display the time part only using CakePHP 4 <?php include_once('../../vendor/autoload.php'); use Cake\I18n\FrozenTime; $now = new FrozenTime(); echo "Time only\n"; echo $now->i18nFormat(...
php
Intelephense squiggly line under function
Adding a missing function definition Using the VS Code Intelephense Extension. You get a squiggly line under a function you know exists. When you hover over it the popup says "Undefined function ... " Go to Preferences and Settings [ Ctrl + , ], search for stubs and...
How to enable ZipArchive on PHP 7.4
Ubuntu / Debian Find the extension version you want to install # install apt-get install php7.4-zip # enable it phpenmod -v 7.4 zip # check it is enabled php7.4 -i | grep -i zip # restart any services such as php7.4-fpm.service to pick up the change systemctl restart...
Using a git repo as a composer repository
So here is the link so I don't forget it https://getcomposer.org/doc/05-repositories.md#vcs Add your repo's URL into your composer.json in the repositories key and change the version on the original repo name to your dev-* version where * is a branch of your github...
PHP Version Gotcha
Just copied some code from a PHP 7.3+ development environment to the server running PHP 7.2 On the server I am getting this On PHP 7.3 it runs fine Because the line number is not listed this is how I find the problem Find which controller is being called when you see...
Populating your Web App with Sample Data during Development
For years I have been using laboriously hand entered test data when developing. Perhaps because coding for me was a hobby and most of the things I was doing didn't need oodles of sample data But recently after doing a Laravel tutorial I was introduced to the Faker...
If you, like me, haven't had formal programming training and would like to see how to properly code in PHP. Have a look at the source code to the Pheanstalk project. IANAP but to me it looks very clean and logical and very DRY (don't repeat yourself)...
Netbeans Removes Indent from // Comments
Been using netbeans for PHP development and discovered that it will remove the leading whitespace from comments and then the comments inside a block of code are hard up against the left margin which looks weird. Not sure if there is a setting to stop this behaviour...
TCPDF KeyWords Doubled in Document Properties Description Tab – Acrobat Reader
This causes the keywords to double when viewed in File ==> Properties ==> Description Tab. $pdf->SetKeywords('CLAM, CLM, Schedule, Program, Meeting, Service Meeting'); This shows the keywords once only: $pdf->SetKeywords('CLAM CLM Schedule Program Meeting...
I have no idea what the problem is PHP CLI
Trying to do some PHP tutorials using vim and running php from the command line and I get.... nothing back. If it's a syntax error (e.g. a missing line ending ; ) then no reply at all. If the syntax is correct and it's something else then the error isn't displayed...
CakePHP 3 – Escape to the Global Namespace
This code in CakePHP 3: <?php $date = '31/01/1973'; $ymd = DateTime::createFromFormat('!d/m/Y', $date)->format('Y-m-d'); Causes this error Error: Class 'App\Controller\DateTime' not found This code fixes it: <?php $date = '31/01/1973'; $ymd =...
XML POST Proxy Script using PHP and libcurl
This is the simplest answer I could find for a client needing to POST an XML SOAP message to a server in another domain. Not sure on the security because the POST isn't validated so it just passes on whatever the client sends. libcurl has a lot of options
Maitland Waterproofing
I have just finished coding a website for a friend. He's running a Waterproofing business. I got him to do the waterproofing in my bathroom renovation, which he did a great job of. I was amazed at how neat the end result was (he used these cute little plastic dishes...