PHP 8.2.0 Alpha 2 available for testing – PHP: Hypertext Preprocessor

The PHP team is pleased to announce the second testing release of PHP 8.2.0, Alpha 2. This continues the PHP 8.2 release cycle, the rough outline of which is specified in the PHP Wiki.For source downloads of PHP 8.2.0 Alpha 2 please visit the download page.Please carefully test this version and report any issues found in the bug reporting system.Please DO NOT use this version in production, it is an early test version.For more information on the new features and other changes, you can read the NEWS file, or the UPGRADING file for a complete list of upgrading notes. These files can also be found in the release archive.The next release will be PHP 8.2.0 Alpha 3, planned for 7 Jul 2022.The signatures for the release can be found in the manifest or on the QA site.Thank you for helping us make PHP better.

Benchmarking Serialization – Larry Garfield

Benchmarking Serialization

I was discussing recently with a TYPO3 colleague about performance, specifically caching. Both he and I are working on systems that may involve hundreds or thousands of objects that need to be cached for later use. The objects themselves are fairly small, but there’s a large number of them. The data format is only internal, so we don’t need anything standardized or parsable by outside systems.

PHP actually has two options for this use case: serialize()/unserialize() and var_export()/require(). But which is better?

Quick, to the benchmark mobile! The results I found were not at all what I expected.

Continue reading this post on PeakD.

Larry
21 June 2022 – 2:42pm

A new OAuth2 client for Javascript – Evert Pot

Frustrated with the lack of well maintained, minimal OAuth2 libraries, I wrote
my own
. This new OAuth2 library is only 3KB gzipped, mainly because it
has 0 dependencies and relies on modern APIs like fetch() and
Web Crypto which are built in Node 18 (but it works with Polyfills on
Node 14 and 16).

It has support for key features such as:

  • authorization_code with PKCE support.
  • password and client_credentials grants.
  • a fetch() wrapper that automatically adds Bearer tokens and refreshes them.
  • OAuth2 endpoint discovery via the Server metadata document (RFC8414).
  • OAuth2 Token Introspection (RFC7662).

If your server does support the meta-data document, here’s how simple the
process can be:

client_credentials example

import { OAuth2Client } from '@badgateway/oauth2-client'; const client = new Client({ clientId: '..', clientSecret: '..', server: 'https://my-auth-server.example'
}); const tokens = await client.clientCredentials();

Without the meta-data document, you will need to specify settings such as the
tokenEndpoint and possibly the authorizationEndpoint depending on which
flow you are using.

authorization_code example

The authorization_code flow is a multi-step process, so a bit more involved.
The library gives you direct access to the primitives, allowing you to
integrate in your own frameworks and applications.

import { OAuth2Client, generateCodeVerifier } from '@badgateway/oauth2-client'; const client = new OAuth2Client({ server: 'https://authserver.example/', clientId: '...',
}); // Part of PCKE
const codeVerifier = await generateCodeVerifier(); // In a browser this might work as follows:
document.

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

A primer on GCP Compute Instance VMs for dockerized Apps [Tutorial Part 8] – Pascal Landau

In the eighth part of this tutorial series on developing PHP on Docker we will take a look on
the Google Cloud Platform (GCP)
and create a Compute Instance VM to run dockerized
applications
. This includes:

  • creating VMs
  • using a container registry
  • using a secret manager