SitePoint PHP Blog: Sculpin Extended: Customizing Your Static Site Blog

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. Jumpstart Your PHP Testing with Codeception

The blog has posted a new tutorial that wants to help you make the most of your application via testing. They show you how to use Codeception to create a set of tests to ensure your application is working as expected.

Before moving on to Codeception and PHP, we should cover the basics and start by explaining why we need testing in applications in the first place. Perhaps we could complete a project without wasting time on tests, at least this time?

Sure, you don’t need tests for everything; for example, when you want to build yet another homepage. […] However, you definitely do need testing when: your team uses BDD/TDD, your Git repo contains more than a couple commits, [and] you are a proper professional, working on a serious project.

They start with a look at the kinds of things testing solves in your development process and the different kinds of tests you can create. From there they introduce Codeception, an alternative testing tool to the widely used PHPUnit. The tutorial helps you get it installed and shows you how to make a simple, first test. It helps you execute the test, debug issues that might pop up and the different assertions you can use. With the fundamentals in place, they move on to more details on using it for functional and unit testing.

Adam Wathan: Writing Your Own Test Doubles

In this recent post to his site Adam Wathan about writing your own custom test doubles (fakes) to help make your tests cleaner and improve their overall readability/maintainability.

Once in a while I run into a situation where trying to use a mocking library hurts the readability of my test. For example, say I’m building out a basic user registration flow where someone signs up and receives a welcome email. […] To test that an account is created correctly, I can make a request to the endpoint and verify that the new account exists in a test database. […] This covers creating the account itself, but what’s the best way to test the welcome email?

He goes through a few of the options that could be used to test this including using Mockery to replace the mailer class with a spy or actually sending emails. There’s downfalls to both of these methods and he suggests using a custom "fake" where the mailer class is swapped out with an "in-memory" option with the same kind of interface. He does point out a few issues with this method, however, and offers a few tips to remember when using them.

Sebastian de Deyne: Normalize Your Values on Input

In a post to his site Sebastian de Deyne makes the suggestion that you should normalize your values (input) as soon as possible.

Dynamic languages allow us to pass anything as a parameter without requiring a specific type. In turn, this means we often need to handle some extra validation for the data that comes in to our objects.

This is a lightweight post on handling your incoming values effectively by normalizing them as soon as possible. It’s a simple guideline worth keeping in mind which will help you keep your code easier to reason about.

He gives an example of a HtmlClass object instance that can take in either a single string or an array of strings. With this structure he shows the complexity it would add for methods like toArray and toString. Instead he recommends normalizing the value in the constructor, making it an array if it’s not already. The the code required in the rest of the class to use/translate it is much simpler.

SitePoint PHP Blog: How to Build Your Own Dependency Injection Container

The SitePoint PHP blog has posted a tutorial showing you how to build something that’s become an integral part of most frameworks and applications practicing modern PHP development: a dependency injection container.

A search for “dependency injection container” on packagist currently provides over 95 pages of results. It is safe to say that this particular “wheel” has been invented.

However, no chef ever learned to cook using only ready meals. Likewise, no developer ever learned programming using only “ready code”. In this article, we are going to learn how to make a simple dependency injection container package.

He walks you through the entire process of creating the container and each of the pieces that make it up:

  • the overall interface for the container (with has/get methods)
  • having it cooperate with the "container interoperability" structure
  • reference handling
  • constructor injection functionality

Code is included the whole way showing you how to create the parts and fit them together to make more of a whole. He ends the post with a look at a few other dependency injection containers and a reference to the repository with the end result of the article.

Zend Developer Zone: Introspecting your Code with Z-Ray for Azure

On the Zend Developer Zone blog Daniel Berman has posted a guide showing how to use their Z-Ray plugin to inspect code running on Azure for statistics around performance, queries and errors thrown by the code.

Quick experimentation, easy collaboration, automated infrastructure and scalability, together with advanced diagnostic and analytical tools – all provide PHP developers with good reasons to develop in the cloud.

[…] The combination of Z-Ray and the Azure cloud means PHP developers building apps on the Azure web app service get the best of both worlds – Z-Ray’s powerful introspection capabilities and Azure’s rich cloud infrastructure.

The post walks you through the steps to create a new Azure-based web application, how to upload your code and enable the Z-Ray feature directly from the Azure "Tools" menu. The Z-Ray toolbar is then automatically injected into your application for your immediate profiling needs.

QaFoo Blog: Analyze the Quality Of Your PHP Code

QaFoo has posted an announcement to their blog about a new tool they’re offering to help developers better visualize the quality of their PHP code with a new visualization tool, the Quality Analyzer.

In code reviews we often browse metrics, source code and reported code issues together with our customers. This leads to discussions about the current state of the code and possible improvements. First we used a bunch of shells scripts for that. In a second step we developed a simple PHP (Open Source) application helping us to do the job. Now we did the third step and rewrote that application into a React based client side (Open Source) application.

They start with an overview of why they created the tool (an evolution of the older Code Review tool) and why it was split into a frontend/backend model to provide easier pipeline integration. They then introduce the functionality in the new tool, based on a D3.js interface. A few screenshots of the interface are also included to give you an idea of how it reports its findings and the dashboard providing an overview of the findings. You can try it out by grabbing it from the project’s GitHub repository.

ServerGrove Blog: New Symfony installer: the fastest way to start your Symfony project

The ServerGrove blog has a new post today introducing the new Symfony Installer, a tool that can make getting started with a Symfony2 application quick and easy.

Yesterday, the Symfony team introduced the new Symfony installer. Its main goal is to help developers to create Symfony projects faster. Until now, installing Symfony to start a new project required a few steps. […] The installer tries to do this in one step. It downloads a compressed file with all the code, including the vendors directory, so you don’t need anything else to run Symfony for the first time.

The post shows you how to install the installer via a curl call to fetch the executable. They show how to use it to create a new project, making a demo project and the resulting application and web interface for the demo. They also mention some of the future work that’s planned for the installer including HTTPS support and caching improvements. The post finishes up with a quick mention of the code „under the hood“ using the Symfony console component.

Link: Building Your PHP Geek Cred öffentlich An Awesome PHP-Entwickler zu sein

Auf der Blog Khayrattee Wasseem hat ein paar Vorschläge über das“ Build Your Geek cred „als PHP-Entwickler – Vorschläge von Ressourcen und Dinge, die Sie tun, um mehr in der Sprache und ihrer Gemeinde beteiligt sind.

Wenn Sie die PHP | Architect Magazine – März 2011 Edition , haben Sie sicherlich die schönen genossen Artikel von Jason Austin (a PHP-Entwickler aus Raleigh, NC) mit dem Titel „ „. Jason spricht über ‚das Warum „und“ das Wie „, um sich als qualifizierter PHP Profi zu unterscheiden von der Masse ab. Und die Art und Weise zu tun, ist: „Du musst deinen Geek cred bauen.“ Ich denke, er hat einen brillanten Job mit dem Artikel.

Einige Khayrattee ’s Vorschläge sind (jeweils mit einer Reihe von „cred Punkte „):

  • mit anerkannten Zertifizierungen wie die Zend Certified Engineer-Programm zertifiziert Get
  • starten PHP Meetup-Gruppe in Ihrer Nähe
  • Melden Sie sich an PHP-Konferenzen auf der ganzen Welt zu besuchen
  • Blog über PHP {haben ein Blog für sie}

Casey Blog: Make Your Life als PHP Developer zweimal so leicht mit phpsh

In seinem (Python) blog heute Casey erinnert die Entwickler-Community über ein praktisches Tool , dass die Entwickler von Facebook zur Verfügung stellen, um ein PHP-Coder das Leben leichter – phpsh .

Die Entwickler von Facebook gebracht haben PHP-Entwicklern eine leistungsfähige REPL jetzt ala-Python zur Abrundung einer soliden Werkzeugkasten, dass PHP-Entwickler bereits haben. Das Projekt heißt phpsh und ist in Python geschrieben.

Er beinhaltet die Befehle, die Sie brauchen, um sie zog aus github und Arbeiten, die Sie mit einer interaktiven Shell direkt auf Ihrem lokalen Rechner (stärker als die eingebauten PHP-Shell) werden. Sie können auch schnappen Sie sich einen zip oder gzip Archiv zum Download bereit. Ausführliche Informationen zu dem Werkzeug und wie es zu benutzen, siehe .