PHP 7.2.30 Release Announcement
The PHP development team announces the immediate availability of PHP 7.2.30. This is a security release.All PHP 7.2 users are encouraged to upgrade to this version.For source downloads of PHP 7.2.30 please visit our downloads page, Windows source and binaries can be found on windows.php.net/download/. The list of changes is recorded in the ChangeLog.PHP Multi Curl Library
Read more at https://www.phpclasses.org/package/11617-PHP-Process-multiple-HTTP-requests-at-the-same-time.html#2020-04-16-06:31:11
Site News: Blast from the Past – One Year Ago in PHP (04.16.2020)
Here's what was popular in the PHP community one year ago today:
- Tomáš Votruba Blog: Is Zend Dead? Is Laravel Losing Breath? Trends of PHP Frameworks in Numbers
- Webslesson: Live CSV File Data Editing and Importing in PHP using Ajax jQuery
- Tomáš Votruba Blog: Pattern Refactoring
- Arkadiusz Kondas Posts: How to run PHP 8 with JIT support using Docker
- Blog entries :: phly, boy, phly: From Zend Framework To The Laminas Project
- Tomáš Votruba Blog: Symfony 4.2 is used Twice More than Symfony 3.4
- The Zend Blog: Zend Framework transitions to the Linux Foundation
- Technical Thoughts, Tutorials, and Musings: PSR-14: Example - plugin registration
- symfony Project Blog: New in Symfony 4.3: Workflow improvements
- JoliCode blog - les derniers articles: Find Segfaults in PHP like a boss
- Derick Rethans: PHP Internals News: Episode 6: PHP Quality Assurance
- Laravel News: Podcast: The Laravel Origin Story
- Stephan Hochdörfer Blog: Using PHPStan to detect errors in your Magento project
- Toptal Engineering Blog: Laravel Zero Downtime Deployment
- Arkadiusz Kondas Posts: The right way to call assertion in PHPUnit
- PHP Town Hall: Episode 63: Dollar Bills Yall - Part 2
- GeekyBoy.com: Zend Framework becomes Laminas project
- Webslesson: Dynamically Add / Remove input fields in Laravel 5.8 using jQuery Ajax
- Voices of the ElePHPant: Interview with Andrew Caya
- php|architect News: Meet the php[tek] Security Chairs
- Voices of the ElePHPant: Interview with Susan Ibach
PHP Internals News: Episode 49: COPA
PHP Internals News: Episode 49: COPA
In this episode of "PHP Internals News" I converse with Jakob Givoni (LinkedIn) about the "Compact Object Property Assignment", or COPA for short, RFC that he is proposing for inclusion in PHP 8.
The RSS feed for this podcast is https://derickrethans.nl/feed-phpinternalsnews.xml, you can download this episode's MP3 file, and it's available on Spotify and iTunes. There is a dedicated website: https://phpinternals.news
Transcript
- Derick Rethans 0:16
-
Hi, I'm Derick. And this is PHP internals news, a weekly podcast dedicated to demystifying the development of the PHP language. This is Episode 49. Today I'm talking with Jakob Givoni about an RFC that is made with a very long name, the compact object property assignment RFC or COPA for short. Jakob, would you please introduce yourself?
- Jakob Givoni 0:39
-
Yes, my name is Jakob. I'm from Denmark, and I've been working programming in PHP for 20 years now. I work as a software engineer for a company in Barcelona that's called Vendo. I got inspired to get involved in PHP internals after I saw you as well as Rasmus and Nikita in a PHP conference in Barcelona last November.
- Derick Rethans 1:00
-
there was a good conference, I always like going there. Hopefully, they will run it this year as well. What I'd like to talk to you about today is the COPA RFC that you've made. What is the problem that this is trying to solve?
- Jakob Givoni 1:14
-
Yes, I was puzzled for a long time why PHP didn't have object literals. And I looked into it. And I saw that it was not for lack of trying. Eventually, I decided to give it a go with a different approach. The basic problem is simply to be able to construct, populate, and send an object in one single expression in a block, also called inline. It can be like an alternative to an associative array. It gives the data a well defined structure, because the signature of the data is all documented in the class.
- Derick Rethans 1:47
-
Of course, people abuse associative arrays for these things at a moment, right? Why are you particularly interested in addressing this deficiency as you see it?
- Jakob Givoni 1:57
-
Well, I think it's a common task. It's something I've been missing, as I said inline objects, obviously literals for a long time, and I think it's a lot of people have been looking for something like this. And also, it seemed like it was an opportunity that seemed to be an fairly simple grasp.
- Derick Rethans 2:14
-
What kind of solutions do people use currently, instead?
- Jakob Givoni 2:18
-
I think, very popular one is the associative array where you define key value pairs as an array. The problem with that is that you don't get any help on the name of the indexes nor the types of the values.
- Derick Rethans 2:33
-
I mean, it's easy to make a typo in the name, right? And it just either exists in the array suddenly, if you set it or you just get a random null value back. As you said, yeah, there's no way of enforcing the type here, of course. COPA compact object property assignment is a mouthful, and it is a new bit of syntax to the PHP language. What is this new syntax going to look like?
- Jakob Givoni 2:55
-
While it looks just like when you assign a value to a property, but here you can add several comma separated lines of property name equals value inside a square bracket block, which is coming after the array and the array arrow operator. The syntax shouldn't really conflict with anything else we have at the moment.
Truncated by Planet PHP, read more at the original (another 19766 bytes)
PHP 7.4.5 Released
The PHP development team announces the immediate availability of PHP 7.4.5. This is a security release which also contains several bug fixes.All PHP 7.4 users are encouraged to upgrade to this version.For source downloads of PHP 7.4.5 please visit our downloads page, Windows source and binaries can be found on windows.php.net/download/. The list of changes is recorded in the ChangeLog.PHP 7.3.17 Released
The PHP development team announces the immediate availability of PHP 7.3.17 This is a security release which also contains several bug fixes.All PHP 7.3 users are encouraged to upgrade to this version.For source downloads of PHP 7.3.17 please visit our downloads page, Windows source and binaries can be found on windows.php.net/download/. The list of changes is recorded in the ChangeLog.PHP Covid Relief Checks Calculator
Read more at https://www.phpclasses.org/package/11613-PHP-Calculate-the-amount-of-a-check-as-Covid-19-relief.html#2020-04-15-13:57:30
When I Get out of Here: The Grumpy Designer’s Post-Quarantine Bucket List
Quarantine is like jail. Well, sort of. Even if being homebound isn’t quite the same as an episode of “Orange is the New Black” or “Oz”, there are definite parallels between the two predicaments. For one, nobody goes to either place happily.
This may sound a bit overdramatic – especially considering I’ve worked at home most of my adult life. But that was by choice. I chose to avoid in-person meetings. I chose a 10-second commute up the stairs each day, as opposed to sitting in traffic. See? There’s a difference.
I doubt it’s just me, though. Freelancers and remote workers around the world are stuck inside (and hopefully safer for it). Quarantine has robbed us of many things, freedom of choice among the most important.
The day the cloud of this pandemic lifts, though, watch out. Oh yes, there will be celebrations aplenty. The earth may even vibrate due to all the dancing. As for me, I have my own little list of things I’d like to do…
Work from a Coffee Shop (Just Once)
This is one of the biggest stereotypes of freelancers. We go out and have a cup of coffee, while staring intently at our laptops for hours.
It’s also something I never really cared to do. Being particular about my work environment, I can’t fathom the distraction of being in a place filled with strangers, trying to get things done. How can I concentrate on buggy code when some fool spills half and half on my shoe?
Yet, I also long for the freedom to have dairy products poured upon me (accidentally, of course). Just maybe, when things improve, I’ll head to Starbucks and pay homage to this act others assume all web designers do.
Introduce Myself to Someone at a Design Conference
With so many events having been cancelled or moved online, the industry is just teeming with loneliness. I’m right there with you, as I had a speaking gig snatched away due to quarantine.
And, while I do feel a sense of camaraderie at conferences, I am a bit of an introvert. As such, I generally don’t approach people and strike up conversations. If someone approaches me, however, I’ll ramble on for what seems like too long. Maybe it sounds weird, but that’s me.
Regardless, I always tell myself that I’ll be more open at these things – someday. Well, what better time than when we’re all free to go to conferences again?
I don’t think I’ll turn into the life of the party. But, just maybe, I can say “Hi” without too much trouble. However, I still may have to opt for the elbow-bump over a handshake.
Make the Weekend a “Work Free” Zone
One side effect of working at home during a quarantine is that you really have no excuse for not working. Even before all of this craziness came upon us, the temptation to head over to the desk during off hours was strong. Now? It’s overwhelming.
On weekends, I’ve found myself with nothing to do (or, nothing I want to do) and nowhere to go. The boredom makes it just too easy to sit down and start working. Before I know it, a few minutes turns into an hour.
The upside is that some items get knocked off of my to-do list. No complaints there. But, feeling compelled to work isn’t all that healthy. Over time, that can add up to being stressed out on what are supposed to be days off.
Eventually, there will be other things to do – even some places to go. But even if that place is just my couch, it will be nice to get away from the office for a few days. And, please pass me a beer.
Look Back with Gratitude
During a time when so much of the world has been shut down, it would be easy to harbor some bad feelings. That would be a natural reaction, I think, as I doubt anyone is really enjoying this historic moment. It’s been tragic for so many, and draining for all.
That being said, it would be nice to find some silver linings. Coming out of this healthy, for one, would be a great start. But there are other things to be grateful for.
Personally, I’m hoping that breaking out of quarantine will result in my being more outwardly grateful. There are so many things I’ve taken for granted.
Family, my business, the ability to work from home – they are at the top of the list. This pandemic has shown that none of these things are a given. They can be taken away without a moment’s notice.
Sure, I’ll still be grumpy after all is said and done. But I can mix in a little gratitude every now and then.
The post When I Get out of Here: The Grumpy Designer’s Post-Quarantine Bucket List appeared first on Speckyboy Design Magazine.
A generic middleware pattern in Typescript
I just realized this is the third time I’m writing async middleware invoker, I thought I would share the generic pattern for the benefit of others.
I’m not sure if this is interesting enough for a NPM package, so I’ll leave it here for inspiration.
The specific middleware pattern I am implementing, is similar to Express, Koa or Curveball.
We’re working off a context
, and we are running a chain of middlewares
in order with this context as an argument.
We’re also passing an next
function. If this next
function is called,
the next middleware in the list will be called. If not, the chain will be
broken.
Furthermore, (unlike Express, but like Koa) middlewares can be async
function or return a promise. If it is, we want to await it.
The setup
Lets start with the setup, describing the middleware:
/**
* 'next' function, passed to a middleware
*/
type Next = () => void | Promise<void>;
/**
* A middleware
*/
type Middleware<T> =
(context: T, next: Next) => Promise<void> | void;
Middleware
is the actual async/non-async middleware function. I made a
type for Next
so I don’t need to write it out more than once.
How we want to use it
This would be the ‘getting started’ section of the documentation.
The idea here is that we have an ‘app’, a set of middlewares and a context we want to operate on.
The following code would be written by the user of this framework:
/**
* The context type of the application.
*
* In 'koa' this object would hold a reference to the 'request' and 'response'
* But our context just has a single property.
*/
type MyContext = {
a: number;
}
/**
* Creating the application object
*/
const app = new MwDispatcher<MyContext>();
/**
* A middleware
*/
app.use((context: MyContext, next: Next) => {
context.a += 1;
return next();
});
/**
* An async middleware
*/
app.use(async (context: MyContext, next: Next) =>
Truncated by Planet PHP, read more at the original (another 5860 bytes)