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

How to Create a Laravel Helper
Apr 21, 2017 @ 15:15:28

On the NetTuts.com site there's a new tutorial from author Sajal Soni showing you how to create a custom Laravel helper, a set of helper functions that can be used through out the entire application.

Laravel includes a variety of global "helper" PHP functions. Many of these functions are used by the framework itself; however, you are free to use them in your own applications if you find them convenient. So, basically, helpers in Laravel are built-in utility functions that you can call from anywhere within your application. If they hadn't been provided by the core framework, you might have ended up developing your own helper classes.

Although the core provides a variety of helpers already, there’s always a chance that you’ll need your own and would like to develop one so you don’t have to repeat the same code here and there, thus enforcing better maintainability. You'll learn how to create a custom Laravel helper in this tutorial.

They start by talking about some of the current helpers and the functionality they relate to (arrays, paths, strings, etc). It then goes into the creation of the custom helper including the skeleton of the code layout, where to place them and how to load them into the application via a service provider.

tagged: custom laravel helper function creation tutorial

Link: https://code.tutsplus.com/tutorials/how-to-create-a-laravel-helper--cms-28537

Programming With Yii2: Routing and URL Creation
Dec 13, 2016 @ 12:15:02

The TutsPlus.com site has posted the next article in their "Programming with Yii2" series, this time focusing on the routing and URL creation in the application and how the requests get to the intended functionality (in controllers).

In today's tutorial, I'll review routing and URL creation in Yii. When a browser request arrives at your Yii application's index.php file, it must be parsed to determine which controller and method to call. That's routing. The reverse process of linking to parts of your application is URL creation, which is best done programmatically.

Yii provides a lot of flexibility in managing routing and generating links. Follow me as I review the basics.

He starts with a bit of background on the URL manager that comes built in to the Yii2 framework and how the routes are defined. He then starts in by defining some of the desired routes for the application and how to set them up in the main configuration file (including defaults). The tutorial also includes configuration examples of "pretty URLs", and outputting custom URLs using the "Url" helper.

tagged: programming yii2 series routing url creation tutorial

Link: https://code.tutsplus.com/tutorials/programming-with-yii2-routing-and-url-creation--cms-26869

Updates to Pricing on New Books
Oct 06, 2016 @ 09:19:49

While not directly related to PHP and its community, several potential technical book authors out there will probably be affected by this. The popular publishing platform, Leanpub, has announced a change in their pricing to create new books with the service.

Leanpub is a powerful platform for serious authors. This platform is the combination of two things: a publishing workflow and a storefront. Leanpub is more than the sum of its parts, however – by combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks, it’s something different.

[...] Our workflow is flexible. Authors can use our simple in-browser editor or upload completed ebook files, but most choose to write their manuscripts on their own computers, using either plain text (formatted using Markdown or Markua markup) or Word documents. [...] Our storefront is an elegant way to sell in-progress or completed ebooks. [...] Our royalty rate is better than Amazon’s and Apple’s royalty rates for any book over $2.99, and it is far better than Amazon’s royalty rate for books over $10.

[...] Today we are changing the pricing of Leanpub. Until now, Leanpub has been totally free for authors to use. [...] Going forward, it will cost money to create a new Leanpub book. Here’s the cost: $99 per book.

Previously the only charges were a percentage of the sales for books on the storefront but moving forward, there will be a flat $99 USD cost for new books created wth the service (in addition to the same royalty rate as before). This helps to fund this great service and keep the level of quality authors have enjoyed so far. More details about the changes for new books and the "grandfathering" of current books can be found on this pricing page.

tagged: leanpub pricing book creation royalty publishing selfpublish

Link: https://leanpub.com/pricing

Paul Jones:
Framework Tradeoffs For Beginners: Product Creation vs Program Maintenance
Jan 22, 2014 @ 11:53:42

Paul Jones has shared some of his thoughts about framework tradeoffs in his latest post. In it he compares two perspectives about framework use for beginners - either the "get something out there" product approach or focusing on the the long term maintenance of the product.

Phil Sturgeon at his blog, writing about product creators who neither know nor care much about programming as a discipline. [...] Phil’s post focuses on the joyful, proud moments of creation that lead to business success, whether in terms of venture funding or continued sales. In this essay, I want to focus on what happens after that, when that initial creation passes into other hands to be maintained.

Paul talks about how frameworks can allow developers to work "beyond their level" and be more productive than they could be otherwise. He points out that this can create a beginner-level codebase that works "just enough" and then is usually passed off to more experienced developers to update, change and flat out fix issues.

From a financial standpoint, and perhaps even from an economic standpoint, it’s easy to see enabling-via-framework as a positive. Indeed, the product creator may justify his failures of good programming practice by substituting the product popularity and continued rounds of funding as a marker of success. [...] But from a programming practices standpoint, enabling-by-framework too often leads to pain and frustration on the part of the maintenance programmers, who are now saddled with the baggage of an amateur.
tagged: framework tradeoff beginner product creation maintenance

Link: http://paul-m-jones.com/archives/5890

Box - Making Creating PHARs Easier
Aug 24, 2012 @ 10:33:52

There's a new project on Github that wants to help making your phar archives for your PHP applications. The process is a little obtuse right now and Box wants to simplify it.

Box is a library and command line application for simplifying the PHAR creation process. [Features include] creating new PHARs with a simple configuration file, add and replace files in existing PHARs, extract existing PHARs, with option to cherry pick files and verify PHAR signatures.

The project is still relatively young but it looks like it's off to a good start. Phar files are a powerful tool to have in a PHP developer's arsenal but developing them can be a pain. Hopefully something like this can make life easier.

tagged: project phar build manage creation github


Michael Maclean's Blog:
Using Pango for PHP: a taster
Feb 22, 2011 @ 12:58:27

Michael Maclean has a new article today talking about the Pango graphics library and how it can be coupled with the Cairo PECL extension to more easily create better looking text in dynamic images.

The PECL/Cairo library is pretty good at drawing vector graphics (in our opinion, as the developers, at least!), but one thing it's not able to do by itself is draw text with mildly advanced layout. [...] That's because the developers of the Cairo library decided to let another more specialised library handle the job of text layout.

Michael has created a wrapper for Pango in PHP (github) and some sample code that can be used as a test to ensure it's all setup and working. He steps through each part of the image creation and describes what's happening and what each method is doing along the way.

tagged: pango image creation cairo text render tutorial


Joey Rivera's Blog:
Automate Db Model Creation with Zend_CodeGenerator_Php_Class
Dec 22, 2009 @ 08:33:06

On the Zend Developer Zone today there's a pointer to a new blog post from Joey Rivera about automating the creation of models in your Zend Framework application via the Zend_CodeGenerator_Php_Class.

This tool has to do a good bit of database manipulation so I've decided I'll build it in PHP using Zend Framework. I'll be using Zend_Db_Table_Abstract to communicate with the db tables from my project and I'll be creating a model for each table as well to store and manipulate data. I'll be working with lots of tables in the database and many have lots of fields.

Because the component lets you dynamically create PHP code, it can easily be used to create the model classes. Joey includes a link to the code you can use to add it into your own projects.

tagged: automate model creation zendframework class


How to Create a Wordpress Theme from Scratch: Part 2
Sep 18, 2008 @ 10:29:20

The NETTUTS site has posted the second part of their series looking at the creation of a custom WordPress template. This time they focus on expanding on the previous version, adding additional parts to the theme.

It's time for the good stuff now. We'll be adding the comments system, a sidebar with widgets and an archive for all the old posts. This will cover all that you need for a simple but well functioning WordPress theme, and hopefully you be able to apply this to all sorts of theming projects.

The give the code to create the sidebar (in their instance, an image from Flickr), handling the comments for each post and make the "archive" section to get to some of the older posts.

tagged: wordpress theme custom scratch tutorial creation


The creation of the new site
May 29, 2008 @ 09:31:01

With the successful relaunch of the PHPFreaks.com website recently, Daniel Egeberg wanted to share a little glimpse behind the work that it took to get to that place. In this new blog entry, he talks about the technology, code and design aspects they worked through.

I thought that, seeing as this is a programmer community, the people who have not had the privilege to have access to the forums where these things were discussed or access to the code itself might be interested in knowing a bit about the underlying technology and code that powers this website

Some of the technologies they use include the Zend Framework running on a CentOS with PHP5.2. Some of the highlights in the coding process included updates to Zend_Auth, using Zend_Acl for access management, content management and other various packages (like Zend_Feed, Zend_Form, Zend_Db, etc).

tagged: creation new release website technology zendframework centos


Kore Nordmann's Blog:
Published article "Image creation with PHP"
Dec 11, 2007 @ 11:11:00

Kore Nordmann has posted a new article series (to the "Articles" section of his site) with six different pieces talking about different aspects of image creation with PHP:

Each of them can be read separately, but they're all part of a series and make more sense when read together.

tagged: image creation article series tools text bitmaps gradient shape format library image creation article series tools text bitmaps gradient shape format library