Software Development Articles
<div class="paragraph"> <p>In versions of Xdebug before version 3 setting up step debugging for code inside Docker containers has often been challenging to say the least. However, in version 3 it’s become almost trivial. In this short tutorial, I’ll step you through what you need to do, regardless of the (supported) text editor or IDE you’re using.</p> </div>
<div class="paragraph"> <p>No matter how small your web app may be, security is essential! In this tutorial, you’ll learn how to add a CSRF token in forms used in Mezzio-based applications, to prevent attackers from being able to force your users to execute malicious actions.</p> </div>
<div class="paragraph"> <p>If you want to build applications in PHP — from one-page apps to enterprise-grade applications — PHP’s Mezzio framework is a excellent framework to choose. In this tutorial, which is an excerpt from my new book, Mezzio Essentials, I’ll show you how to manually build an application in Mezzio.</p> </div>
It’s with some sadness, that earlier this week, I wished a fond farewell to the biggest blog I ever created, Master Zend Framework. Given that, it only feels right — and responsible — to talk about what motivated the decision to close the blog, and what the future holds for the blog’s content.
If you&rsquo;re getting started learning Java, whether because you want to or you have to, I want to help you out, as I&rsquo;m learning Java again too. In this post, I set out what I think you need to know to get started with it, or what your first few steps will likely entail.
How do you test abstract classes in PHP? Find out how to test them in this post by using PHPUnit&rsquo;s getMockForAbstractClass method.
Debugging requests can be a time-consuming process. However, there&rsquo;s a tool that makes doing so a lot simpler. It&rsquo;s called Postman. In this tutorial, I step you through its core features and show you how to use them.
PhpStorm offers so much functionality. From syntax highlighting to Docker integration, it’s an extremely comprehensive tool. However, have you ever thought of using it to run your unit tests? In this article, I step you through running tests, from an entire suite to an individual test.
Git interactive rebase is a powerful tool that can help you fix up your commit history to make it more meaningful, professional, and maintainable. In this post, I step through what it is, how it works, and when you should — and shouldn&rsquo;t — use it.
There are lots of tips, tricks, and ideas around for hacking your command-line productivity to make you more efficient. However, in this post, I&rsquo;m not going to show you something that&rsquo;s super in-depth, ultra-detailed, or talk about an app that you have to install, ctrl+x+e.
Still using var_dump to debug your PHP code? Stop! While var_dump can be convenient, it’s a very blunt approach. In this article, I’ll show you how to set up proper debugging with PhpStorm, Xdebug, and PHPUnit, and give you a modern, sophisticated debugging experience.
Is your website (or web-based application) not performing like you expect it should? Not sure why or what to do about it? Then come learn about some key things you can do to have your website perform properly.
Writing code is a very creative endeavour. However, if you&rsquo;re not careful, you may well end up wasting a lot of time writing code that you don&rsquo;t have to.
Git, despite still being a bit terse, is extremely powerful version control software. However, because it&rsquo;s so powerful, it takes time to learn. In this post, I&rsquo;m going to show you four small techniques to help you use it more effectively.
I&rsquo;ve been a proud VIM user for years — dating back as far as 1999 — but especially so, since I pushed myself to learn it properly a few short years ago. However, I wonder if I&rsquo;ve become too wedded to it. And I&rsquo;m keen to find out if you are too.
Ever wanted to dynamically expand the functionality of an object which you retrieve from your dependency injection container, based on different needs, yet without creating messy, hard to maintain configurations? Then you&rsquo;re going to want to know about a powerful new technique - called Delegator Factories.
Git is known to be incredibly terse, though it has improved in recent years. What’s more, there’s a plethora of commands that you need to remember. So, why not learn about OhMyZsh and Git Extras and make your life with Git easier!
Do you write Linux shell scripts? Do your scripts work on more than one distribution? If so what does your development environment look like and what tools do you use to let you develop, debug, and maintain your scripts both quickly and relatively hassle-free?
If you use Git as your VCS (version control system), you’ll know that it has excellent diff support on the command line. However, even as good as it is, it still leaves a bit to be desired — at least when compared with tools such as GitHub.
Ever thought of creating a Zend Expressive module, one that either scratches an itch or allows you to use a set of related functionality across multiple Zend Expressive projects? I created one recently and share how I did it with you in this three-part series.
A little while ago, I took to Twitter in a sense of jubilant excitement announcing that VIM was THE distraction-free editor. As it&rsquo;s been quite some time since, I honestly don&rsquo;t remember exactly what it was that motivated me to do so.
If you need to quickly create a PR of the changes between two branches, GitHub is the quickest and most pragmatic choice. Here’s why.
If you need to migrate Zend Expressive applications from version one to two, don&rsquo;t do everything by hand! Save yourself time, and make use of Zend Expressive Tooling.
Recently, Jeffrey Way dateed what&rsquo;s become quite a controversial video in the PHP community on Laracasts, discussing a concept called Visual Debt.
For the longest time, Zend Framework hasn&rsquo;t had the strongest support for command-line tooling and scaffolding. However, in recent times, that&rsquo;s all changed. Come find out how to use Expressive&rsquo;s new tooling support to create modules and middleware rapidly.
A little while ago, I wrote two parts in a multi-part series about using Docker. As someone who’s reasonably new to Docker — <strong>and</strong> been bitten by the Docker bug — I wanted to share what I’d learned, in the hopes that others may benefit.
If you’re using docker-compose to build a Docker container setup and something&rsquo;s not working, here&rsquo;s a basic process you can follow to find out what happened, and get your containers up and running properly.
Rapid application development isn&rsquo;t often associated with Zend Framework. However, thanks to the ReflectionBasedAbstractFactory, rapid prototyping and developing in Zend Framework is as simple as Laravel. Come find out how in this tutorial.
Want to save time generating dependency configuration files for your Zend ServiceManager dependencies? In today&rsquo;s tutorial, I&rsquo;ll show you how, by using ConfigDumper, available in ServiceManager 3.2.0.
Want to save time generating factories for your Zend ServiceManager dependencies? ServiceManager 3.2.0 contains FactoryCreator. In today’s tutorial, let’s see how to use it and how to save you time and effort.
How well do you really know Composer? Do you just know composer install, update, and require, and some of the composer.json configuration? Or do you really know it? In this series, you’re going to take your skills to the next level; starting with the command-line.
I’ve been developing software in PHP for a long time. But I recently decided to return to my polyglot roots, developing in multiple languages on a regular basis. The question is, which language, or languages, are the right ones to learn and use.
If there’s one thing that we as developers to do on a regular basis it’s navigate through code. In this tutorial, I’m going to show you a range of ways in which PhpStorm does so, minimising the effort required by us.
If you are managing one or more Zend Framework 2 applications, did you know that you can already begin porting them to Zend Expressive? In this tutorial, you will learn how you can start today, using the Zend/PSR-7 bridge.
Building a local development environment which mirrors production hasn&rsquo;t, historically, been an easy task. But with Docker, it&rsquo;s become, virtually, trivial. Come learn how to setup a local development environment using Docker for developing Zend Expressive (and other PHP) applications.
Laravel’s Eloquent ORM isn’t likely the first one you think of when using Zend Expressive. You likely think of Zend\Db or Doctrine. But, with a little bit of work, it’s possible to use Eloquent with Expressive. Today’s tutorial shows you how - step-by-step.
A common requirement of web-based applications is to upload and download files. But, out of the box, there’s no simple way to download them in Zend Expressive. This tutorial shows you how - step-by-step.
Can you develop application in Zend Expressive as easily as you can with Laravel? Is it possible to make Zend Expressive fly, like Laravel does out-of-the-box? Recently I sought to find out. Here&rsquo;s my step-by-step guide to doing it + some key recommendations.
Zend Expressive is an excellent framework for building modern applications; whether micro or enterprise-sized applications. But that doesn’t mean that it’s the easiest to get up to speed with. Today I&rsquo;m going to share with you what I&rsquo;ve learned, building applications using it.
In a recent application I found that I was too bound to a database as the application’s data source and wanted to decouple from it as much as possible, whilst using the least amount of effort. During research into the required changes, I came across an excellent pattern which gives a lot of flexibility, yet which doesn’t require a lot of code - it’s called the repository pattern.
When working with other developers on a project, editor and IDE differences, whilst not fatal, can be annoying, and even violate group coding standards. Put an end to that by using EditorConfig.
PHP 7 presents enormous benefits over all previous versions. But is your code ready? In this tutorial, find out what needs to be done using the Phan static code analyser.
Using Codeception as your testing framework of choice? Did you know it’s really easy to test Zend Expressive TableGateway classes? It&rsquo;s almost painfully easy. This tutorial walks you through, step-by-step.
In case you missed the news, Zend Expressive 1.0.0 Stable Has Been Released
Zend Expressive is a great foundation on which to build an application, especially if you want to keep it small and lean. But out of the box, form view helpers aren’t available. Here’s how to make them available.
Over the last number of months the Zend Framework team’s been hard at work on Zend Framework 3. And there are major changes afoot. In this 2-part series, we look at one of the core components - Zend Expressive.
Over the last number of months the Zend Framework team’s been hard at work on Zend Framework 3. And there are major changes afoot. In this 2-part series, we look at one of the core components - Zend Expressive.
Is it reasonable, even practical, to expect that a 30 year old application can match a modern one?
If you want to change a layout for one or all actions in a controller, how do you do it without overriding the layout globally? Today&rsquo;s post shows how.
Zend Framework 2, like all great PHP frameworks, provides thorough infrastructure for creating forms in your application. Whether that&rsquo;s form objects, form elements, fieldsets, validation groups or that they interact with so many other components in the Zend Framework 2 default libraries. But how do you handle external dependencies?
This week we look at two of the prevailing Git development workflows: GitFlow and GitHub Flow, weighing up the pros and cons of each.
In part two of the \Zend\Db\Sql\Select series, we create inner, outer, left and right joins as well as union queries with ease. Come learn more about building queries simply, effectively and easily in your every day applications with Zend Framework 2.
Today I take you through the Zend Framework 2 EventManager. We&rsquo;ll look at the EventManager key patterns, how it works and step through with some hands on code.
When you&rsquo;re working with HTML day in and day out, very often the same types of tasks come up repeatedly. Whether you&rsquo;re generating content to be displayed with PHP or jQuery, whether it&rsquo;s server or client side, it&rsquo;s not an easy task. You Need a Helping Hand!
The Zend Framework Bootstrap can be one of the key aspects of getting up and running quickly with the Zend Framework. Let&rsquo;s make it easy.
<p>Recently I was asked how to rename a file with the Zend Framework that used a Zend Form and Zend File element. They key requirement was that it should not be a hack or a kludged solution. So I thought I&rsquo;d write a quick post to provide a simple example on how it was achieved.</p>
<p>Ok, we&rsquo;ve established that with the Zend Framework, we need to do a bit more work than some of the other frameworks to get up to speed - but that&rsquo;s not necessarily a bad thing - right?! But it can be a bit tedious and it&rsquo;s something as professional developers, we want to automate away. So we&rsquo;ve been addressing in this series how to do just that with a custom, extendable bootstrap class.</p> <p>In the <a href="http://www.maltblue.com/2011/10/software-development/php/a-simple-bootstrap-for-the-zend-framework" title="A Simple Zend Framework Bootstrap">first part of the series</a> we laid the foundation of our custom bootstrap class by creating a custom class directory structure, adding its namespace to the application ini and modifying the default application bootstrap so that it extends from it and had a look at the first component - caching.</p> <p>Then, in <a href="http://www.maltblue.com/2011/11/software-development/php/frameworks/zend-framework/zend-framework-bootstrap-made-simple-part-two" title="The Zend Framework Bootstrap made simple (Part 2)">the second part of the series</a>, we built on the foundation laid in part one by creating plugin resources for the <em>routing table</em>, <em>application navigation</em> and the <em>database connections</em> - these being some of the most common tasks, usually, associated with a web-based application.</p> <p>In this, the third and final part of the series, I&rsquo;m going to finish up by looking at application placeholders and surprise, no not logging as originally promised, but <em>pagination</em>. As an added extra, we&rsquo;re going to be using a <em>key feature</em> of Zend Application to make it a breeze.</p>
<p>In the <a href="http://www.maltblue.com/2011/10/software-development/php/a-simple-bootstrap-for-the-zend-framework" title="A Simple Zend Framework Bootstrap">first part of the series</a>, you&rsquo;ll remember that we laid the foundation of our custom bootstrap class by creating a custom class directory structure, adding its namespace to the application ini and creating our custom bootstrap file that our application bootstrap will extend from.</p> <p>After we did that, we put in the first but arguably the most important plugin resource – caching and stored it in the application registry. In this post we&rsquo;re going to be building on that work and adding in three new plugin resources: routing, navigation and databases.</p>
<p>When you&rsquo;re creating a new project with the Zend Framework, unlike other frameworks, you need to do more legwork. This isn&rsquo;t necessarily a bad thing, but it can sure slow you down when you&rsquo;re trying to plough through a project.</p> <p>I really enjoy using it, as it has a very well structured approach – and I like structure – it clearly lays out a file-system structure for <em>modules</em>, <em>controllers</em>, <em>actions</em>, <em>forms</em>, <em>models</em> and so on. It has good, but basic, tooling, allowing for modest project initialisation. But despite all this, it still requires a healthy investment on our part to get a proper foundation in place to use it productively.</p> <p>In a recent project I encountered this situation and felt that I mustn&rsquo;t be the only one to do so. As I plan to keep using Zend Framework I want to work around this situation and get as much productivity out of it as possible right from the get go. But how to do this?</p> <h2 id="bootstrapping">Bootstrapping</h2> <p>Well the primary focus for me is bootstrapping. It provides the majority of the core services that every project needs, from routing, data source connections, authentication, authorisation, navigation, caching and so on. So it stands to reason that it&rsquo;s a good place to start. So I want to cover what should go in to a good working bootstrap.</p>
<p>Let me describe said situation for you; The user has a list of items and they&rsquo;ve chosen to delete one. Given such a volatile action, you want them to <strong>doubly opt-in</strong> and confirm that they want to do this.</p> <p>The last thing you want your user to feel, after they&rsquo;ve clicked the delete link, is &ldquo;<strong>NO WAAAAAAIIIIT! I didn&rsquo;t mean to do that</strong>&rdquo;. So the user clicks &amp;'<strong>delete</strong>&amp;' and is directed to a confirmation page (which is rendered with <em>Zend Form</em>). There are two buttons on the page; the first is &ldquo;<strong>Delete Item</strong>&rdquo;, the second &ldquo;<strong>Cancel</strong>&rdquo;.</p> <p>If the user clicks either button, the form submits to itself, where the value of the button clicked is determined. If the user clicks &ldquo;<strong>Delete Item</strong>&rdquo;, then the deletion is carried out, deleting the item from the datasource. If the user clicks &ldquo;<strong>Cancel</strong>&rdquo; the user is returned to the list of items they were previously viewing, the item is not deleted and the user is provided a message, confirming the non-deletion.</p>
<p>So in <a href="http://www.maltblue.com/2011/06/tutorial/extending-zend-auth-a-test-adapter" title="Extending Zend Auth – A Test Adapter">the last installment</a> of this series, I provided an introduction to <em>Zend_Auth</em>, <em>Zend_Auth_Adapter_Interface</em> and Zend_Auth_Result and how to implement Zend_Auth_Adapter_Interface to implement a basic test adapter that can be used as a mock object in your testing.</p> <p>If you missed it, check it out now, then come back and we&rsquo;ll continue on. If you&rsquo;ve already read it, then let&rsquo;s continue now.</p> <p>As I indicated last time, whilst being a perfectly valid implementation, the Test adapter was rather basic and didn&rsquo;t do very much. Like all good testing, you need flexibility and options. So in this installment, we&rsquo;re going to build an adapter based around Zend_Config. This will lead quite nicely in to the last part in the series which uses the wonderful MongoDB as the underlying resource for the adapter.</p>
Zend_Auth provides a very extensible workflow for creating new adapters to suit your authentication needs. In this post, I start you off with a simple Test/Mock adapter.
Do you want a scalable, high performance PHP application that logs everything in an intelligible manner; in a manner that you can use now, tomorrow and three weeks from now? It&rsquo;s so possible! In a series of posts, I am going to show you how to put it together using Zend Framework, ZeroMQ and Hadoop.
<p>Zend Auth, if you want to secure a Zend Framework app, along with Zend Acl, it&rsquo;s essential. But do you know what it is? Do you know how to use it? Do you know how to extend it? Through this series I&rsquo;m going to show you how to do all three.</p>
phpMagazin recently did a good job of covering Zend_Translate; specifically what it is, how it works and four of the basic translation adapters; those being Array, CSV, Gettext and Ini. However, what they didn&rsquo;t cover was what I think, is one of the best choices of adapters that Zend_Translate has; which is TMX.
<p>This is a mini-post showing you how to get up and running with <strong>mongoDB</strong> and <strong>Zend Framework</strong> using a series of third-party libraries, including <strong><a href="https://github.com/coen-hyde/Shanty-Mongo" title="The Shanty-Mongo Zend Framework MongoDB library by Coen Hyde">Shanty-Mongo</a></strong> library. To be honest, it&rsquo;s rather trivial, but sometimes it can be frustrating trying to find a simple, concise, reference on how to do it, specific to just your needs.</p>
After stating our 11 Reasons Why A PHP Framework is better than Raw PHP, here&rsquo;s 11 Reasons Why A PHP Framework is better than Raw PHP It, often, has a solid community of professionals developing and supporting it It&rsquo;s, often, coded to an exacting, mature, coding standard It has a solid development history, reviewed by many eyes It has defined methods of doing repetitive things quickly and simply You&rsquo;re not on your own and call fall back on people for support It&rsquo;s, often, simple to link in with existing 3rd party libraries – quickly and easily You&rsquo;re working within clear constraints and development concepts You can bring in developers already experienced with using and deploying it There are tried and true practices for deploying it There are tried and true practices for testing it Frameworks carry brand and industry recognition What do you think?
Here&rsquo;s My 11 Reasons Why Raw PHP is better than a Framework It&rsquo;s faster as it doesn&rsquo;t have the framework library overhead It can be cleaner, lacking legacy cruft You can craft it exactly as you want it You&rsquo;re not bound by someone else&rsquo;s rules or concepts You can add in as many or as few 3rd party libraries as you choose You can write to your own standard It is portable You can license it as you choose You set the standard by which it is judged You build the philosophy of the project The work is all yours to live or die by What do you think?
Zend Framework, one of the big frameworks today. Is it the right choice, is it the wrong choice? We believe it&rsquo;s one of the right choices for professional PHP development. Here&rsquo;s 10 reasons why!
<p>The Zend Framework, whilst a great tool, is often slighted for being big and bloated. Now I&rsquo;m not contesting that, but it does have a heck of a lot going for it. So if you&rsquo;re going get the most out of it, then you need these 10 tips.</p>
Like any profession or trade, you can spend years refining your craft; always looking for the path of least resistance; the path of greatest simplicity, which leads to your goals in the shortest time and the least amount of effort. Especially in software development, you try to simplify and automate as much as you can. Not only do you save unnecessary time, but you get to devote your energies to the most meaningful aspects; the areas that bring greatest productivity and satisfaction to you and your client or employer.
In this article, a follow up to writing a secure, Restful service with the Zend Framework, I&rsquo;m going to cover the HTTP status codes that you should use, where and when. The reason for this is that they&rsquo;re a fundamental aspect of the interaction with the service. You get this right and you will make it so much better for clients to use your service; you get it wrong and you may only have a few users and they may do a lot of work for very little gain.
I&rsquo;ve been using mongoDB and Zend Framework to make a simple, replicatable filesystem. As it went well, I thought that I could quickly apply what I&rsquo;d done to create an ultra-simple blog system. Read on to find out all about it.
So you&rsquo;re up with the RESTful buzz but you&rsquo;re concerned about security; as you should be! So what do you do? Well, like all good OOP practitioners, you don&rsquo;t reinvent the wheel. As Steve Jobs said, &ldquo;Good artists create, Great artists Steal&rdquo;, or borrow in our case. So let&rsquo;s look at the Amazon S3 model and implement that with our framework of choice - Zend Framework to protect your RESTful services.
<p>Do you love the variety of formats that you can publish and subscribe to in this veritable golden-age of computing we&rsquo;re enjoying? Same here. Whether it&rsquo;s JSON, <acronym title="eXtensible Markup Language">XML</acronym>, <acronym title="Really Simple Syndication">RSS</acronym>, Atom, CSV or even Excel format, there&rsquo;s just so much choice.</p> <p>The challenging thing is that though there&rsquo;s so much choice of format, there are also so many demands to use them - ALL. So what do you do when your boss, client, friend, family-member (<em>whom you&rsquo;re the technical support person for</em>) requests this for their blog or site?</p>