Platform.sh + Lando: local dev in perfect sync with the cloud – platform.sh

Platform.sh removes a major pain point for developers: having to invest time in managing servers, virtual machines, or containers. Instead, Platform.sh enables developers to focus 100% of their time on their code. Since the beginning, Platform.sh has provided instant cloning capability, so dev teams can work on perfect copies of their production sites in the cloud for every Git branch.
Now, in partnership with Lando, we’re extending that capability to the desktop.

PHP 7.2.30 Release Announcement – PHP: Hypertext Preprocessor

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.

Taking your application to SaaS: a business decision – platform.sh

Why have some great apps not evolved to SaaS? With new technology they still can.
For digital agencies and established software vendors, this blog offers insight into how easy it is now to launch and manage a full cloud SaaS offering with a PaaS. In my last article, I shared the recent story of a white-label client who launched their software-as-a-Service cloud offer and grew in value from 2.5x to 12x revenue over two short years.

Managing Multiple PHP versions via the ondrej/php PPA – Matthew Weier O’Phinney

Last week, I did some system updates, and then decided to compile the most
recent PHP releases. I’ve used phpbrew to
manage multiple PHP releases for a number of years, and having it install a new
version is fairly routine.

Except this time, it wasn’t. Due to updates I installed, I was getting errors
first with compiling the GD extension, then with ext-intl:

  • If you want Freetype support in ext-gd, you are expected to install the
    package libfreetype-dev. On Ubuntu, this now installs libfreetype6-dev, which
    no longer includes the freetype-config binary that PHP’s configure script
    uses to determine what features it supports.

  • Similarly, ext-intl depends on the package libicu-dev. Ubuntu’s package now
    omits the icu-config binary used by PHP to determine feature support.

I searched for quite some time to find packages that would resolve these
problems. I could have found the source code and compiled it and linked to that,
but that would mean keeping that up-to-date on top of my PHP installs.

I even looked in the ondrej/php PPA, as that repository
has multiple PHP versions already, including source packages.

And then I thought: why not try using those instead of phpbrew?

The rest of this post is how I made that work.

I use Ubuntu for my operating system. The instructions I present here should
work on any Debian-based system, but your mileage may vary. If you are using
an RPM-based system, yum will be your friend, but I have no idea how to add
repositories in that system, nor if update-alternatives is available. As
such, these instructions may or may not help you.

Which is okay. I mainly wrote them to help future me.

Register the PPA

First, I had to add the PPA to the system:

$ sudo add-apt-repository ppa:ondrej/php

Then the usual:

$ sudo apt update

Approach to installation

I first identified the extensions I typically install, matched them to
packages in the PPA, and made a list. I knew I’d be installing the same
extensions across all PHP versions I wanted, so I figured I could script it a
bit.

From there, I executed the following from the CLI:

$ for VERSION in 5.6 7.0 7.1 7.2 7.3;do
for> for EXTENSION in {listed all extensions here};do
for for> sudo apt install php${VERSION}-${EXTENSION}
for for> done
for> done

This grabbed and installed each PHP I needed along with all extensions I wanted.

Switching between versions

To switch between versions, you have two options:

  • Use the version-specific binaries: /usr/bin/php5.6, /usr/bin/php7.0, etc.

  • Set a default via update-alternatives:

    $ sudo update-alternatives --set php /usr/bin/php5.6
    

    If you’re not sure what you have installed, use:

    $ sudo update-alternatives --config php
    

    which will give you a listing, and an ability to select the one to use.

Rootless alternatives

What if you’d rather not be root to switch the default version, though?
Fortunately, update-alternatives allows specifying alternate config and admin
directories.

Define the following alias in your shell’s configuration:

alias update-my-alternatives='update-alternatives \ --altdir ~/.local/etc/alternatives \ --admindir ~/.local/var/lib/alternatives'

Additionally, make sure you add $HOME/.local/bin to your $PATH; since
defining $PATH varies based on the shell you use, I’ll leave that for you to
accomplish.

If you open a new shell, the alias will now be available; alternately, source
the file in which you defined it to have it take effect immediately.

Once you’ve done that, you can run the following, based on the PHP versions
you’ve installed:

$ for VERSION in 5.6 7.0 7.1 7.2 7.3;do
for> update-my-alternatives --install $HOME/.local/bin/php php /usr/bin/php${VERSION} ${VERSION//./0}
for> done

This will create alternatives entries local to your own user, prioritizing them
by version; as a result, the default, auto-selected version will be the most
recently installed.

You can verify this by running update-my-alternatives --config php:

There are 5 choices for the alternative php (providing $HOME/.local/bin/php). Selection Path Priority Status
---------------

Truncated by Planet PHP, read more at the original (another 7476 bytes)

PHP Internals News: Episode 49: COPA – Derick Rethans

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 19767 bytes)

PHP 7.4.5 Released – PHP: Hypertext Preprocessor

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 – PHP: Hypertext Preprocessor

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.

IBM and Zend by Perforce Announcement for IBM i Users


Building a Strong Future for All

As a close IBM partner for more than 14 years, Perforce Software continues to help the IBM i community build on its existing investments with open source technologies. This includes providing Zend Server for IBM i, which delivers a secured, supported, and certified PHP stack for IBM i, along with cutting-edge tools for application monitoring, profiling, caching, and code tracing.

A generic middleware pattern in Typescript – Evert Pot

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)