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

Matt Stauffer:
Introducing Laravel Dusk (new in Laravel 5.4)
Feb 06, 2017 @ 15:46:06

Kicking off his series of posts looking at the new features that come along with the v5.4 release of the Laravel Framework Matt Stauffer has posted a look at Dusk, a tool that makes it simpler to test your Laravel based applications.

If you follow anyone in the Laravel world on Twitter, or if you listen to the Laravel Podcast, you know by now that Laravel Dusk is the new face of application testing in the Laravel world.

[...] With Dusk, Taylor has completely re-written how application testing works in Laravel. Everything is now based on a tool called ChromeDriver, which is a standalone server that actually controls Chrome/Chromium. When you write application tests, Dusk sends your commands to ChromeDriver, which then spins up Chrome to run your tests in the browser and then reports back the results.

He starts with a brief look at how testing was being performed in most cases on Laravel applications (using the "Integrated" package) but pointed out that that only really worked for non-Javascript driven sites. With the introduction of Dusk and it's use of the ChromeDriver to make "browsing" in the test simpler. He includes the installation process of the latest version of Dusk and an example test checking to be sure the string "Laravel" is in a page. He includes a gif of the test in action and talks about some of the new interactions and assertions included in the tool. He wraps up the post looking at the use of Pages and a few other miscellaneous tips to help you get your testing up and working productively.

tagged: laravel framework testing dusk introduction tutorial interactions pages

Link: https://mattstauffer.co/blog/introducing-laravel-dusk-new-in-laravel-5-4

Symfony Finland:
How to implement AMP (Accelerated Mobile Pages) on the eZ Platform CMS
Aug 29, 2016 @ 16:44:58

On the Symfony Finland site they've posted an introductory article showing you how to implement accelerated mobile pages (AMP) in an application based on the ez Platform CMS.

Accelerated Mobile Pages is an initiative from Google to speed up mobile browsing. AMP is an open standard based on HTML. It enforces performance by limiting functionality and includes remote caching.

Given Google's continuing dominance search both publishers and CMS vendors need to take AMP into account. In this article you'll learn the basics of how to implement AMP with eZ Platform CMS and Symfony.

The post starts out with a bit of background about AMP and how it relates back to the main content of the site. With that knowledge in place the author moves into the code, showing how to use annotations to create the route, building and returning the template including the meta and link tags required to link this AMP version back to the main content page.

tagged: tutorial amp mobile pages accelerated symfony twig meta link

Link: https://www.symfony.fi/entry/how-to-implement-amp-accelerated-mobile-pages-ez-platform-cms

SitePoint PHP Blog:
Sculpin Extended: Customizing Your Static Site Blog
Aug 19, 2016 @ 17:22:56

The SitePoint PHP blog has a new tutorial posted helping those Sculpin users out there get the most from their site with some helpful customization tips. Sculpin is a PHP-based static site generation tool that converts Mardon files and Twig templates into HTML documents ready for use.

If you’re a PHP developer and currently running a blog with a static site generator such as Octopress or Jekyll, wouldn’t it be great if you could use your primary language for it? Yes, it’s healthy for us developers to use more than one language, but let’s be honest – we often want to add some functionality to our blogs, but it’s difficult to accomplish in unfamiliar syntax. In this article, we’ll set up Sculpin, a static site generator for PHP. Just like any other static site generator, it uses markdown files and HTML templates to generate your blog, so the transition should be easy.

The tutorial starts by helping you get Sculpin installed (as a phar executable) and move it to where it's globally accessible. With that installed the article then helps you make a simple blog, customize some of the basic settings and start in on a new blog post. With that in place it then gets into the customization, adding in:

  • syntax highlighting
  • Disqus commenting
  • blog archive links

The post finishes up showing you how to deploy the resulting blog into a GitHub pages repository and pushing them out for public consumption.

tagged: sculpin extended tutorial static site github pages syntaxhighligh disquis archive

Link: https://www.sitepoint.com/sculpin-extended-customizing-your-static-site-blog/

Matthew Weier O'Phinney:
Automating GitHub Pages Builds with MkDocs
Feb 01, 2016 @ 16:49:57

In this new post to his site Matthew Weier O'Phinney details the process they (Zend) used to create the documentation for the latest release of their Expressive PSR-7 compatible framework (now in v1.0).

One of the final tasks in prepping for the Expressive 1.0 release was setting up the documentation site. We'd decided to use GitHub Pages for this, and we wanted to automate builds so that as we push to the master branch, documentation is deployed.

The process turned out both simple and bewilderingly difficult. This post is intended to help others in the same situation.

While they decided on MkDocs for the actual document generation (written in Python) Matthew how he integrated it with the builds they'd already created for the Expressive framework. He talks about reusability for the process, eventually using it again on the Zend Framework side. He also shows the full process for creating the resulting documentation and pushing it over to GitHub Pages including the setup of the credentials, which events should trigger the build and handling environment variables and software dependencies. It's a great post with plenty of details on each step of the process - I'd highly recommend it if you're looking into building these sorts of documents for your project.

tagged: github pages build travisci mkdocs python tutorial process

Link: https://mwop.net/blog/2016-01-29-automating-gh-pages.html

Amine Matmati:
Testing PDF content with PHP and Behat
Jul 31, 2015 @ 18:49:52

In this post to his site Amine Matmati shows you how to use Behat (with a bit of additional PHP) to test the contents of a rendered PDF file.

If you have a PDF generation functionality in your app, and since most of the libraries out there build the PDF content in an internal structure before outputting it to the file system (FPDF, TCPDF). A good way to write a test for it is to test the output just before the rendering process.

Recently however, and due to this process being a total pain in the ass, people switched to using tools like wkhtmltopdf or some of its PHP wrappers (phpwkhtmltopdf, snappy) that let you build your pages in html/css and use a browser engine to render the PDF for you, and while this technique is a lot more developer friendly, you loose control over the building process.

He shows how to get all of the required software installed including the smalot/pdfparser library used to read in the contents of the PDF file. He initializes a Behat test directory and writes a simple test, checking for a string of some "Lorem ipsum" text in the document's title and that it contains only one page. Some additional methods have to be created to integrate the PDF parsing and string location/page counting and code is included for each. When all the pieces are put in place, executing the test passes for both checks. You can find the code for the tutorial in this repository that also includes two sample PDFs to work with.

tagged: integration test behat contents string pages tutorial

Link: http://matmati.net/testing-pdf-with-behat-and-php

DevShed:
Building Dynamic Web Pages with Polymorphism in PHP 5
Mar 28, 2007 @ 23:15:35

DevShed continues their look at using polymorphism in an application with the latest part of the series - "Building Dynamic Web Pages with Polymorphism in PHP 5".

In short, Polymorphism is a feature exposed by certain objects that belong to the same family, which eventually can behave differently, even when they're using identical methods. Or more clearly, an object can be considered polymorphic when it's capable of performing different actions by utilizing the same method.

This time they focus on web page development that uses this object-oriented practice. The create a WebPageElement that you can ID and class attributes on and use it to create HTML widgets and extend them to create Div and Link element.

tagged: php5 polymorphism dynamic pages html elements php5 polymorphism dynamic pages html elements

Link:

DevShed:
Building Dynamic Web Pages with Polymorphism in PHP 5
Mar 28, 2007 @ 23:15:35

DevShed continues their look at using polymorphism in an application with the latest part of the series - "Building Dynamic Web Pages with Polymorphism in PHP 5".

In short, Polymorphism is a feature exposed by certain objects that belong to the same family, which eventually can behave differently, even when they're using identical methods. Or more clearly, an object can be considered polymorphic when it's capable of performing different actions by utilizing the same method.

This time they focus on web page development that uses this object-oriented practice. The create a WebPageElement that you can ID and class attributes on and use it to create HTML widgets and extend them to create Div and Link element.

tagged: php5 polymorphism dynamic pages html elements php5 polymorphism dynamic pages html elements

Link:

DevShed:
Using HTTP Compression in PHP - Make Your Web Pages Load Faster
Apr 10, 2006 @ 20:26:56

One of the holy grails of web development is to have your pages lost the fastest way possible. People spend hours optimizing images and condensing the amount of data they actually send over the wire to reach this goal. There are, however, other ways to achieve some of the same results, HTTP compression being one of them. For those that aren't familiar with the topic, DevShed has this new article to bright you up to speed.

This article, the first of three parts, shows you how to make PHP pages load faster by showing you how to compress dynamic PHP pages. Techniques covered include using PHP's built-in "gzencode()" function, along with output buffering control functions.

Since PHP offers a powerful built-in library for handling HTTP compressed data, over this series I'll explain the basics of working with HTTP-compressed PHP pages. I'll illustrate, with several code samples, different methods for compressing dynamic PHP pages.

They start with the basics, writing up a simple script to compress the output from a simple PHP file, one that displays records from a "users" database. With that foundation laid, they move on to the heavy stuff - using more than just simple output buffering to speed up those pages. Their new example makes use of the gzip functions in PHP to compress the data even further. A gzip header is passed off to the browser and it pulls it all neatly compressed over to open on the client-side.

tagged: compression http pages load faster gzip output buffering compression http pages load faster gzip output buffering

Link:

DevShed:
Using HTTP Compression in PHP - Make Your Web Pages Load Faster
Apr 10, 2006 @ 20:26:56

One of the holy grails of web development is to have your pages lost the fastest way possible. People spend hours optimizing images and condensing the amount of data they actually send over the wire to reach this goal. There are, however, other ways to achieve some of the same results, HTTP compression being one of them. For those that aren't familiar with the topic, DevShed has this new article to bright you up to speed.

This article, the first of three parts, shows you how to make PHP pages load faster by showing you how to compress dynamic PHP pages. Techniques covered include using PHP's built-in "gzencode()" function, along with output buffering control functions.

Since PHP offers a powerful built-in library for handling HTTP compressed data, over this series I'll explain the basics of working with HTTP-compressed PHP pages. I'll illustrate, with several code samples, different methods for compressing dynamic PHP pages.

They start with the basics, writing up a simple script to compress the output from a simple PHP file, one that displays records from a "users" database. With that foundation laid, they move on to the heavy stuff - using more than just simple output buffering to speed up those pages. Their new example makes use of the gzip functions in PHP to compress the data even further. A gzip header is passed off to the browser and it pulls it all neatly compressed over to open on the client-side.

tagged: compression http pages load faster gzip output buffering compression http pages load faster gzip output buffering

Link:

DevShed:
Private Pages with PHP and Text Files
Feb 27, 2006 @ 15:16:15

DevShed has this new tutorial posted today concerning the use of text file authentication to create "private pages" in your site.

You run a website that is simple enough it doesn't require a database. But your site features certain pages to which you'd like to limit access. Most of the time, that implies using a database to store passwords and usernames. There is an easier way, however. It's less secure, but it involves a lot less coding.

They step you through the process - creating the form, making the PHP page for it to submit to, checking the password (including a bit on encryption), and validating the user's entry against it.

tagged: private pages text file authentication nd5 encryption private pages text file authentication nd5 encryption

Link:


Trending Topics: