<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Php on ZeroSharp</title><link>https://www.zerosharp.com/blog/categories/php/</link><description>Recent content in Php on ZeroSharp</description><generator>Hugo</generator><language>en-gb</language><copyright>Copyright © 2012–{year} Robert Anderson</copyright><lastBuildDate>Thu, 02 Mar 2017 11:37:00 +0100</lastBuildDate><atom:link href="https://www.zerosharp.com/blog/categories/php/index.xml" rel="self" type="application/rss+xml"/><item><title>Improvements to Serverless PHP support</title><link>https://www.zerosharp.com/improvements-to-serverless-php-support/</link><pubDate>Thu, 02 Mar 2017 11:37:00 +0100</pubDate><guid>https://www.zerosharp.com/improvements-to-serverless-php-support/</guid><description>&lt;p&gt;I was inspired by two events to jump back into serverless framework.&lt;/p&gt;
&lt;img class="img-left" src="https://www.zerosharp.com/images/blog/serverless-php-improvements-001.jpeg" alt="200 Serverless London Meetup"&gt;
&lt;p&gt;Firstly, I attended the second &lt;a href="https://www.meetup.com/Serverless-London/"&gt;London serverless meetup&lt;/a&gt; yesterday evening which was excellent and showed just how much enthusiasm there is for serverless architectures. Check out their new logo on the left. It was significant that each of the three speakers announced that they are actively hiring serverless developers.&lt;/p&gt;
&lt;p&gt;Secondly, &lt;a href="https://github.com/Stolz"&gt;Stolz&lt;/a&gt; has contributed improvements to my sample project for integrating PHP into the serverless framework. It&amp;rsquo;s the purpose of this blog post to cover the changes.&lt;/p&gt;</description></item><item><title>A concrete PHP Serverless example - export chess games in PDF</title><link>https://www.zerosharp.com/a-concrete-php-serverless-example/</link><pubDate>Tue, 29 Nov 2016 17:37:00 +0100</pubDate><guid>https://www.zerosharp.com/a-concrete-php-serverless-example/</guid><description>&lt;p&gt;In &lt;a href="https://www.zerosharp.com/the-serverless-framework-and-php/"&gt;the last post&lt;/a&gt; I built a PHP capable sample project for &lt;a href="https://serverless.com/"&gt;the Serverless Framework&lt;/a&gt;. In this post, I&amp;rsquo;ll show a concrete use of it.&lt;/p&gt;
&lt;p&gt;The service I&amp;rsquo;m building connects runs a PHP function for pretty-printing chess games from the &lt;a href="http://lichess.org/"&gt;lichess online chess server&lt;/a&gt;. &lt;a href="https://github.com/clarkerubber/lichessPDFExporter"&gt;James Clarke&lt;/a&gt; has written a PHP function to do this using &lt;a href="http://www.fpdf.org/"&gt;fpdf17&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The lichess exporter takes the game id of any game that has been played on the lichess server and produced a PDF output. Take for example, Game 8 of the current World Championship which is &lt;a href="https://en.lichess.org/COQChpzH"&gt;here&lt;/a&gt;. When I open the resulting file, I see this:&lt;/p&gt;</description></item><item><title>The Serverless Framework and PHP</title><link>https://www.zerosharp.com/the-serverless-framework-and-php/</link><pubDate>Mon, 21 Nov 2016 09:21:00 +0100</pubDate><guid>https://www.zerosharp.com/the-serverless-framework-and-php/</guid><description>&lt;p&gt;The goal of this post is to explain how to call a PHP function from within an AWS lambda using the &lt;a href="https://serverless.com/"&gt;Serverless Framework&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="prerequisites"&gt;Prerequisites&lt;/h2&gt;
&lt;p&gt;First check everything we need is installed.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ serverless --version
1.1.0
$ node --version
v7.1.0
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="install-the-sample-php-function"&gt;Install the sample PHP function&lt;/h2&gt;
&lt;p&gt;Install my sample &lt;em&gt;Hello&lt;/em&gt; function from my github repository.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ sls install --url https://github.com/ZeroSharp/serverless-php
&lt;/code&gt;&lt;/pre&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Serverless: Downloading and installing &lt;span class="s2"&gt;&amp;#34;serverless-php&amp;#34;&lt;/span&gt;…
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Serverless: Successfully installed &lt;span class="s2"&gt;&amp;#34;serverless-php&amp;#34;&lt;/span&gt;.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2 id="the-code"&gt;The code&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;$ cd serverless-php
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let&amp;rsquo;s have a look at the &lt;code&gt;serverless.yml&lt;/code&gt; file.&lt;/p&gt;</description></item></channel></rss>