Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Cees-Jan Kiewiet:
ReactPHP with RecoilPHP: Creating for/http-middleware-psr15-adapter
Feb 09, 2018 @ 17:21:13

Cees-Jan Kiewiet is back with the latest tutorial in his series covering ReactPHP and RecoilPHP. In the previous parts he introduced some of the basic concepts and set up the first bits of code combining ReactPHP and RecoilPHP. In this latest tutorial (part three) he shows how to integrate this with a PSR-15 compliant middleware to evaluate response time.

There are more uses for coroutines than just making working with promises easier. In this post we're diving into the details on how they are used by the Friends of ReactPHP in the PSR-15 Middleware adapter for react/http.

When we started discussing how middleware for react/http should work we also look at the state of PSR-15 at the time. We decided against implementing it directly because of the fully blocking nature of PSR-15, in favour of callable. Which turned into an even better decision when return type hints where added to it to PSR-15. Now I love PSR-15, and middleware in general, which is why I created for/http-middleware-psr15-adapter to bridge the gap.

He starts with the code required to create a normal PSR-15 middleware and recreating the same functionality in a ReactPHP middleware. The article then shows how to use the package he developed to transform the middleware "on the fly" to enable it to be used both as a normal PSR-15 middleware and as a ReactPHP middleware. He ends the post with a word of caution and a bit of advice about using this method of rewriting - basically that just because you can doesn't mean you should.

tagged: reactphp recoil psr15 middleware translate onthefly package tutorial part3 series

Link: https://blog.wyrihaximus.net/2018/02/reactphp-with-recoilphp-party-three-http-middleware-psr-15-adapter/

Delicious Brains:
Introducing WP Image Processing Queue - On-the-Fly Image Processing Done Right
Mar 09, 2017 @ 15:28:59

The Delicious Brains site has a new tutorial posted introducing WP Image Processing Queue, a tool that allows for on-the-fly image processing in your WordPress application via background processing.

I think the best solution is to get background processing into WordPress core so that all themes/plugins can share a single queue and ensure we don’t impact server performance. And so started my crusade.

At PressNomics, I had a great chat with Mike Schroder. He presented a very good path to core: find a feature that WordPress core needs and that needs background processing. In other words, piggyback! This is exactly how the image optimization stuff made it into core last year: by piggybacking off of responsive images. For background processing, he proposed coming up with an alternative to on-the-fly image processing (OTFIP). Whoa, turns out OTFIP is a problem we regularly deal with for WP Offload S3 as well. This could be a “two birds – one stone” kind of thing. Stars were aligning.

He talks more about some of the current discussions and efforts around processing the images like this (with OTFIP, On The Fly Image Processing). He covers some of the libraries that are currently out there for this processing and how, ultimately, the image processing queue came out to replace them as a result of some work at WordCamp US Contributor Day. He gives an example of the code needed to resize the images and the resulting markup. The post ends with the work he's planning on getting this queuing into the WordPress core and encourages plugin authors to use the OTFIP functionality rather than an external library.

tagged: wordpress image processing queue introduction onthefly

Link: https://deliciousbrains.com/introducing-wp-image-processing-queue/

InformBank.com:
How to create Microsoft Office documents on the fly using PHP
Aug 07, 2006 @ 16:57:37

In this new tutorial from InformBank posted today, they show how to use PHP (and a few handy tricks) to create Microsoft Office documents on the fly.

Sometimes you have to generate some MS Office document for the users of your website using dynamic data. For example, few days ago, I had to generate some Excel reports using data from some tables in MySQL. I knew about the COM but it has a lot of disadvantages, including Windows-only platform and not very high speed. CSV is much easier and faster but you can't format the cells to make them better-looking. The method I've never thought about before was using HTML.

So here came the inspiration and after some research and experiments I wrote this tutorial for all of you who are looking how to create Office documents on the fly using PHP. Of course, I included the COM methods and some methods to create other MS Office documents like DOC and PPT, to make this tutorial as full and as useful as possible.

The tutorial starts with the creation of documents (Word, Excel, Powerpoint) with the COM functionality (the standby method PHP has had for a while). Of course, it also requires the script to be running on Windows to work. So, what's the other option? As he goes on to explain, it's something as simple as HTML.

He includes two examples of alternate mathods, showing hhow to use HTML or a CSV file to create a custom Excel document. He also throws in some code to help you stream out the resulting document as a zip file to the browser.

tagged: microsoft document onthefly com extension html csv file microsoft document onthefly com extension html csv file

Link:

InformBank.com:
How to create Microsoft Office documents on the fly using PHP
Aug 07, 2006 @ 16:57:37

In this new tutorial from InformBank posted today, they show how to use PHP (and a few handy tricks) to create Microsoft Office documents on the fly.

Sometimes you have to generate some MS Office document for the users of your website using dynamic data. For example, few days ago, I had to generate some Excel reports using data from some tables in MySQL. I knew about the COM but it has a lot of disadvantages, including Windows-only platform and not very high speed. CSV is much easier and faster but you can't format the cells to make them better-looking. The method I've never thought about before was using HTML.

So here came the inspiration and after some research and experiments I wrote this tutorial for all of you who are looking how to create Office documents on the fly using PHP. Of course, I included the COM methods and some methods to create other MS Office documents like DOC and PPT, to make this tutorial as full and as useful as possible.

The tutorial starts with the creation of documents (Word, Excel, Powerpoint) with the COM functionality (the standby method PHP has had for a while). Of course, it also requires the script to be running on Windows to work. So, what's the other option? As he goes on to explain, it's something as simple as HTML.

He includes two examples of alternate mathods, showing hhow to use HTML or a CSV file to create a custom Excel document. He also throws in some code to help you stream out the resulting document as a zip file to the browser.

tagged: microsoft document onthefly com extension html csv file microsoft document onthefly com extension html csv file

Link:


Trending Topics: