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.

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.

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.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.

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.

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)

Early release of the Advanced Web Application Architecture book – Matthias Noback

In the Epilogue of the Object Design Style Guide, I started happily outlining some of the architectural patterns I’ve been using for several years now. I wanted to give some kind of an overview of how the overall design of your application would improve if you apply the object-design rules in that book. I soon realized that an Epilogue was not enough to cover all the details, or to communicate the ideas in such a way that they would be applicable in everyday projects. And so a new book project began…

I started working on it exactly a year ago, in April 2019. The initial excitement kept me going for the first 100 hours or so, after which other projects came up (like the re-release of the style guide with Manning, lots of programming projects and trainings). Finally there was some time to finish the work, but then the Corona crisis kicked in.

Even though it’s a strange time to be releasing a new book, I think it’s ready to be read by you. I’m very happy to be using the Leanpub platform again. My experience with Manning was great, but I wanted to be completely independent again, so I could experiment with several new forms of publishing. A book alone is nice, but I wanted to offer a more elaborate learning experience this time, which is why I’m offering several things at the same time:

Get a new chapter every two weeks

Book cover

I’m releasing the book while I’m still working on it. Right now an early release is available for $15,-. It contains the preface, an overview of the contents, the introduction chapter which introduces the concept of infrastructure code, and the first chapter of the first part of the book. The first part is called “Decoupling from infrastructure”. The first chapter is about designing the domain model in a decoupled way.

During the following months I’ll be publishing one new chapter at least every two weeks, and every time this happens, the minimum price will go up with 2 dollars. Note that if you get your copy now, you will be entitled to all future updates.

Gain access to a new platform: “Read with the author”

Read with the author

There’s a special package available on Leanpub which gives you access to the new “Read with the author” platform. If you buy that package, you can join a regularly scheduled video chat, where we go over a new chapter every two weeks. You will be able to use these sessions to deepen your understanding of the topic, and learn about related topics that didn’t make it into the book. You can ask questions too, so you’ll be prepared in the best possible way when you start applying the ideas from the book to your own projects.

Inspect a showcase project that illustrates the book’s concepts

Showcase project

The book itself contains many architectural principles and design patterns, illustrated with code samples and diagrams. However, not all the relevant details fit on a page. And sometimes things are a bit different in a real-world project than they are in idealized code sample scenarios. In fact, the real-world project that I offer alongside the book is the “Read with the author” platform which I’ve just described. Its code base follows the concepts explained in the book and shows how the different objects work together to provide a working application that is not another Todo app, but a normal application, with everyday use cases we can all relate to. Reading through the code and the tests will provide you with many implementation ideas for your own projects.

Access to the showcase project is kindly supported by Gitstore.

Conclusion

I hope that all of this adds up to a nice reading experience, and that you’ll have fun with the book, and any combination of related products. Get it now, while it’s hot, and join other readers in their adventure!

And as always: thank you very much for your ongoing support and interest.

P.S. If you want to buy this book for your team, or for multiple teams: check out the Team and Enterprise licenses.

Go 2ème langue est en ligne – PHP-GTK Community

Haut de couverture du livre

Le mini-site associé au livre “Le Langage Go – les fondamentaux du langage”, est en ligne et 100% traduit.

Ce site est l’occasion de trois premières pour OSInet:

  • Premier site interne totalement bilingue, avec l’intégralité du contenu disponible en français et en anglais.
  • Premier site réel sous Hugo et non Drupal ou Dokuwiki
  • Premier site à décrocher un score 100/100 (desktop) sur Google PageSpeed Insights