PHAR-files are a great way to bundle code that can then be used like a binary. Therefore PHAR-files are often used for tools that can be included in a CI/CD setup. As they are self-contained archives they use their own autoloading mechanism and therefore don’t depend on your code. Which is great if you want to use them as build-tools because the tools dependencies don’t interfere with your project dependencies.
Imagine you’d want to use a build tool that requires PHP 7.2 with your legacy code that still needs to run with PHP 5.6… Most probably your
composer require --dev awesome/build-tool would not work because of a dependency mismatch. Even though you might be on PHP 7.2 at the moment. Using the PHAR-file removes that dependency as all the required files are contained within the archive. And the PHARs autoloader takes care of getting the right files.
Continue reading Scoping PHAR-files
Today I had to execute a function everytime I appended content to an HTML-Document. Easy thing, you’d say: Add the function right after appending the stuff to the DOM…
Continue reading Adding custom events to jQuery-Functions
The other day I had to find a way to output relative dates. So instead of a localized version of “on the 19th of December 2017 at 16:24 the User x did Y” the requirement was to say “3 minutes ago the User X did Y” (or “last Wednesday at 16:24 the User X did Y”… you get the picture).
Continue reading Relative Dates
So in my last blogpost I showed how to automatically create a PHAR-file using Travis-CI. It didn’t take long for a challenge to show up: Digitally sign the resulting PHAR-file.
I already did some work with encrypting and decrypting stuff for an individual automated deployment to a server a few months back. So signing stuff shouldn’t be that complicated I thought. Therefore: Challenge accepted!
I recently was asked whether JUnitDiff was available as a PHAR. Up to that point I hadn’t actually thought about it. But it made sense. The only thing I was sure about was that I didn’t want to have to think about it when doing a release. So the solution should fit nice into the build-chain.
Continue reading Building a phar – automated