Tag: PHP
-
How to disable the X-Mailer header with PHPMailer
Sometimes things aren’t quite as you’d expect them to be. One such case is when you try to disable the X-Mailer header with the PHPMailer library. The library itself is pretty straight forward, you instantiate the class, and then you can interact with headers as object properties as such: $mailer…
-
Filtering WordPress menu items
Recently I had a request come in to update the navigation on a WordPress site. The way the request was worded made me think the change to the menu needed to happen on one specific page, and not across the entire site. This created an interesting problem, as the theme…
-
Time zone conversion with PHP
I do not like time zones. They’ve been a fairly regular pain point in my career, especially early on. There was even a time when I built something and totally forgot that time zones existed and well, it was a mess. For the most part, time zones don’t cause me…
-
Setting an authorization header when using file_get_contents with PHP
Going through some of my old lists of blog post ideas this weekend. While it’s not something I’ve needed for a minute, it’s still something worth taking about. How to set an authorization header when using PHP’s wonderful file_get_contents() method. Similar to an old post of mine talking about specifying…
-
Juggling assertion syntax between PHPUnit versions
I’m no stranger to the nuances of testing against different version of PHP and PHPUnit, but my previous issues were related to the environment itself. Recently I ran into an issue with different syntax between versions of PHPUnit, specifically assertRegExp() being deprecated, which was throwing an error. Not only was…
-
Passing a test without assertions with PHPUnit
While it may seem counter intuitive to have a test that doesn’t have any assertions, PHPUnit’s unique method of sharing data between tests can put you in a situation where you have a test that just doesn’t need to actually test anything, and simply returns some data. In those scenarios,…
-
Increase memory limit for Composer
Gone are the days of stitching together disparate services in an effort to create a solid continue integration and deployment pipeline. GitLab has had it’s Runners for a while and recently GitHub stepped into the mix with their Actions offering. Because of this, using external services like Travis CI or…
-
Only run step for specific version with GitHub Actions
With my recent exploration of GitHub Actions, I’ve had to figure out things that I’ve already figured out with other systems like GitLab Runners and Travis CI. One such thing is conditionally running steps. For things like code coverage, I’m only interested in sending off the coverage report to the…
-
How to loop through all files in an S3 bucket in PHP
Recently I decided to finally tackle the ever growing S3 bucket for the niche social network I run. The reason it’s ever growing is because I never implemented any sort of hard deletion logic. At one point, I was planning to move the images over to soft deletions, but never…
-
Symlinks with Nginx and PHP-FPM
Recently I’ve been putting time into rebuilding the server infrastructure for Holiday API. This has included hardening the system to be more fault tolerant and building out a new cluster of web servers. The biggest improvement was [finally] introducing a continuous deployment pipeline to complement the existing continuous integration flow….