Some handy Carbon constants
– twitter.com – Edit
?♂️⏲️ Just found all these handy class constants in Carbon - woohoo! ? pic.twitter.com/pL0HeKGVx4
— Caleb Porzio (@calebporzio) 29 juni 2018
Read more [twitter.com]
– twitter.com – Edit
?♂️⏲️ Just found all these handy class constants in Carbon - woohoo! ? pic.twitter.com/pL0HeKGVx4
— Caleb Porzio (@calebporzio) 29 juni 2018
Read more [twitter.com]
– josephsilber.com – Edit
Joseph Silber, a very active Laravel contributor, has written a new blogpost on morph maps, a feature to decouple your database from your model class names.
Polymorphic relations let you set up a relationship between many different model types, without the need for extra tables. This works by storing the "morphable type" (explained below) in the database, in addition to the morphable type's ID. By default, the morphable type stored in the database is the model's full class name. While this works, it tightly couples your database to your PHP application. Let's look at how we can instruct Eloquent to use more generic values for these morphable types.
Read more [josephsilber.com]
Join 9,500+ smart developers
Get my monthly newsletter with what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.
No spam. Unsubscribe anytime. You can also follow me on X.
"If you are one of the *millions* who have downloaded a Spatie package, then you understand the quality that Freek aims for. The newsletter is of the same quality of any Spatie package you're using."
– twitter.com – Edit
I often use Eloquent's `query` just to have the code better aligned#visualdebtisreal pic.twitter.com/0JWrzx6wEN
— Freek Van der Herten (@freekmurze) 2 juli 2018
Read more [twitter.com]
– markbakeruk.net – Edit
Mark Baker, serial conference speaker and creator of the PhpSpreadsheet package shares some thoughts on how to create private classes using anonymous classes.
I’ve written before about the benefits of using PHP’s Anonymous Classes for test doubles; but Anonymous Classes also have potential usecases within production code as well. In this article I’m going to describe one such usecase that can be particularly useful within libraries, and that is replicating the access of Package Private (in Java), or Protected Internal Classes (as per C#).
Read more [markbakeruk.net]
– twitter.com – Edit
Just sent an email to internals@, detailing what I hope could be the beginning of a blueprint for PHP 8. It's a small step in what would hopefully be a long and fruitful journey.
— Zeev Suraski (@zeevs) June 25, 2018
Here's a sneak peak for the JIT part: pic.twitter.com/GMXXWvtRly
Read more [twitter.com]
– twitter.com – Edit
? Customizing the error bag on a Laravel form request is as easy as setting a property. I find this comes in handy if a template might have multiple error checks. pic.twitter.com/b0lsP5oJ6G
— Paul Redmond ?? (@paulredmond) 26 juni 2018
Read more [twitter.com]
At Spatie We are currenlty building a new company website. One of the cool features is that it won't set a single cookie. In a new blogpost Dieter Stinglhamber explains how you can achieve this in Laravel.
Since May 25th you have been harassed by "We have updated our privacy policy" emails but also websites started to great you with "Please, let us and our 256 partners track you". In response to these abusive practices, some developers have decided to follow a better path, removing every cookie that is not needed.
Read more [dieterstinglhamber.me]
Toon Daeleman, developer at Engagor, explains how functional languages use recursion instead of loops.
Most programming languages have language structures to loop through lists and do interesting stuff with those lists. When you're used to programming using one of those languages, it can be pretty terrifying to have your basics taken away from you when you jump into a functional programming language like Scheme or Haskell. Let's see what the problem is that functional languages have with loops and how they solved it.
Read more [engagor.github.io]
– www.sammyk.me – Edit
Sammy Kaye Powers, the host of the PHP Roundtable podcast, wrote a blogpost on how to compile PHP from source including unreleased RFC's. After following this tutorial you'll be able to play with the [typed properties] that are currently under discussion.
We'll be discovering and testing a completely unreleased feature of php-src from an RFC that's still under discussion. If you've ever wanted to be ahead of the curve of PHP features or you've just wanted to contribute back to PHP internals, testing an unreleased feature from an RFC is a fun and educational way to do so.
Read more [www.sammyk.me]
– externals.io – Edit
On the PHP internals mailing list Zeev Suraski, a long time core contributor of PHP, started a discussion on what PHP 8 could look like.
As I mentioned a few days ago I intended to send it slightly later - but as Nikita brought up the topic of PHP 8, this is probably as good a time as any to start the discussion. Please note: The goal of this email isn't to discuss in detail each and every topic that's mentioned, but rather to establish whether we want to move to focus on PHP 8 as we go beyond PHP 7.3, based on some of the research projects and PoCs we've been working on.
Read more [externals.io]
– Edit
Frederick Vanbrabant recorded a new cool video, this time on EditorConfig.
EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs. The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems.
– twitter.com – Edit
?? Use Eloquent's "->is()" method for more expressive and thorough assertions pic.twitter.com/8zx8AEm9Rw
— Caleb Porzio (@calebporzio) 22 juni 2018
Read more [twitter.com]
by Freek Van der Herten – 4 minute read – Edit
Recently I was working on a client project where a data import was performed via queues. Each record was imported in its own queued job using multiple queue workers. After the data import was done we had more rows than expected in the database. In this blogpost I'd like to explain why that happened.…
Mattias Noback shares how you can migrate a code base that fetches its dependencies using static method calls to code that uses dependency injection.
I've worked with several code bases that were littered with calls to
Zend_Registry::get(),sfContext::getInstance(), etc. to fetch a dependency when needed. I'm a little afraid to mention façades here, but they also belong in this list. The point of this article is not to bash a certain framework (they are all lovely), but to show how to get rid of these "centralized dependency managers" when you need to.
Read more [matthiasnoback.nl]
Joe Watkins, core PHP developer and author of (amongst many other things) ptrheads, is busy creating a PHP debugger written in PHP that you can just composer require.
This isn't just pipe dreams, the PHP code exists, it's alpha quality and largely untested ...There is much to do and you shouldn't design your workflow around this (or any alpha quality software) yet. What you should do is start reading code, testing, and opening pull requests...
You'll find the code of Joe's debugger in this repo on GitHub.
Read more [blog.krakjoe.ninja]
– twitter.com – Edit
?♂️So you think that code always flows through either the if or else branch in a PHP script?
— Freek Van der Herten (@freekmurze) June 13, 2018
Hold my ?
----
<?php$pid = pcntl_fork();
if ($pid) {
echo 'in if';
}
else {
echo 'in else';
}
----
Try it out!#processcontrol #fun
Read more [twitter.com]
– v-fonts.com – Edit
Nick Sherman created a cool site where you can play with variable fonts.
This site’s goal is to help designers and developers become more familiar with OpenType variable fonts in a way that isn’t overwhelming, while also providing straightforward info upfront about the font projects, who made them, and where to find more info or get the fonts to use.
Read more [v-fonts.com]
– hiddedevries.nl – Edit
On his blog [Hidde De Vries] recaps a talk by Sir Tim Berners-Lee, the inventor of the web, on redecentralising the web.
However, if we’re not careful, Berners-Lee warned, there can also be a vicious circle, a dystopian scenario. This happens when algorithms cause people to meet more people like themselves, narrows down their circle and alienates them from people who are different. Or when websites are used to harvest people’s personal data that are then used for political gain.
Read more [hiddedevries.nl]
– Edit
Bram Van Damme, who runs the excellent bram.us blog recently gave a talk at the Frontend United 2018 conference on what will be coming to JavaScript in the next few years.
With ES2015 a lot has changed in JavaScript-land. Lesser known releases are the ES2016 and ES2017 releases. This talk not only touches these two new releases, but also looks forward at what’s to come next for JavaScript (ES2018 and more).
You'll find the videos of the other talks at Frontend United in this playlist on YouTube.
– github.com – Edit
A GitHub repo containing easy to understand PHP snippets.
Read more [github.com]