News Feed
Sections




News Archive
feed this:

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

Gonzalo Ayuso:
Building a Pimple/Container from a YAML file
September 29, 2014 @ 10:54:10

In a recent post to his site Gonzalo Ayuso shows how to create a Pimple container (a dependency injection container) from a YAML configuration definition using a simple handler already included in Pimple.

[In a conversation with Máximo Cuadros about Dependency Injection Containers] I said that I prefer Symfony´s DIC instead of Pimple, mainly because its configuration with YAML (or even xml) files. But In fact we can customise Pimple/Containers with YAML files in a similar way than we do it with Symfony's DIC. In this example we're going to see one way to do it.

While Pimple does come with the "Container" functionality to make this happen, Gonzalo points out that using it this way violates several of the SOLID design principles. Instead, he offers an alternate solution - using the Config component from Symfony to handle the creation of the container using an already established YAML format. He includes an example YAML configuration structure, the matching Pimple code for it and a code sample showing how the YAML is parsed into the same result. You can find the code on his GitHub account if you're interested in the full structure.

0 comments voice your opinion now!
pimple symfony container solid config yaml dependencyinjection

Link: http://gonzalo123.com/2014/09/29/building-a-pimplecontainer-from-a-yaml-file/

ServerGrove Blog:
Symfony2 components overview Config
February 21, 2014 @ 12:13:57

The ServerGrove blog has a new post today in their Symfony2 component spotlight series, this time focusing on the Config component.

After a few weeks, we continue with the Symfony2 components series. This time we are going to be talking about the Config component, which helps you to load and validate configuration values, regardless of their source.

They show how it can be used to parse YAML files and give a basic overview of its architecture. Sample code is included for a "blog generator" example that parses the given YAML structure and a loader to pull in the file. The component also includes caching functionality for larger configurations and allows you to define multiple loaders for different sources.

0 comments voice your opinion now!
symfony2 component overview config yaml tutorial

Link: http://blog.servergrove.com/2014/02/21/symfony2-components-overview-config

Evan Coury:
Environment-specific configuration in Zend Framework 2
July 19, 2012 @ 11:36:06

Evan Coury has a new post looking at setting up environment specific configurations in a Zend Framework 2 application letting you switch between configs based on an environment variable.

So you're all excited to try out ZF2. You clone the skeleton, install some modules, maybe even follow Rob Allen's excellent ZF2 tutorial, and finally, start building your application. Now, if you're a former ZF1 user or refugee from another framework, you might be troubled at this point by the fact that, at first glance, ZF2 doesn't appear to take into consideration environment-specific configuration values (e.g., development, testing, staging, production). Luckily, this is not the case!

He includes a bit of sample code showing how you can use a simple getenv call to pull in the value from an "APPLICATION_ENV" environment variable and put it into an autoload path.

0 comments voice your opinion now!
zendframework2 environment config variable getenv


Richard Thomas' Blog:
Solar Framework Shorts - Controlling form layout
August 17, 2010 @ 14:57:00

Richard Thomas has a new "Solar Short" posted to his blog to make life easier using the Solar Framework. This quick spotlight is about controlling the layout of the standard form renderer.

Solar's form system is pretty powerful and you realize the full beauty when auto generating forms directly from models but by default it uses a DL/DD/DT list for formatting your labels/inputs. If your not a fan of that formatting you can do something about it.

You can define the decorator tags in your framework's installation to replace the tags used for the list, element, label and the value output of the form. One of the comments on the post also suggests using the "decorateAsDiv" method the Solar_Form object provides to force the output into a div.

0 comments voice your opinion now!
solar framework control form output config


Ben Scholzen's Blog:
Writing powerful and easy config files with PHP-arrays
May 11, 2009 @ 12:05:45

Ben Scholzen has written up a post about how regular PHP arrays can be used as a native configuration option for your applications.

I was asked many times how I organize my config files, and my response was always the same, until some time ago when I switched began refactoring the codebase of my blog. [...] Looking at [the advantages of PHP config files], you may ask now why not everbody is using them. Well the problem mostly is that you cannot create extend-sections (when working with Zend_Config for example).

He compares an example of a method that, using a base config file with some "smarts", you can have it automatically pull in certain files and overwrite settings from the array inside. A sample "other config" file is also included, showing the definition of some PHP settings, resources and database information.

0 comments voice your opinion now!
configuration file array zendframework zendconfig smart base config


Make Me Pulse:
Using the Zend Framework URL rewriting
January 15, 2009 @ 07:55:15

New from the Make Me Pulse blog is this quick tutorial about bending the URL rewriting that the Zend Framework does to match whatever your needs might be.

Today for a good website's referencement in Google, it's necessary to have an URL rewriting. [...] If your application is based on ZF, we have a htaccess base file which will redirect all php files to the boostrap (what is the bootstrap ?), and ZF classes will manage all redirection rules. How to implement the URL rewriting with ZF classes ?

He sets up a config file (an ini file) with the routing instructions the framework will need to adhere to and shows how to get the application to include it and match against it for routing rules. His example sets a default route and several regular expression-based routes to remap requests right where they need to go.

0 comments voice your opinion now!
zendframework config file ini routing regex default route tutorial


Abhinav Singh's Blog:
PHP Extensions - How and Why?
December 12, 2008 @ 11:17:23

Abhinav Singh has posted a guide to PHP extensions - what they are and how to write a simple "hello world" one.

Assuming you have read the previous post, lets discuss on how to build our first PHP extension: every PHP extension is built out of minimum of 2 files, a configuration file (config.m4) which tells us what files to build and what external libraries are needed and source File(s) which will contain the actual functionality.

He builds up an example skeleton for an extension (the config.m4) and explains how the file will be phpized and configured. Next up is the php_sample.h header file where the needed modules are loaded and the sample.c file to define them. Last, but not least, comes the extension code itself that calls the printf function to output the "hello world" message.

0 comments voice your opinion now!
extension tutorial header file config phpize helloworld


Developer Tutorials Blog:
Why you should be using YAML for config
January 25, 2008 @ 11:22:00

The Developer Tutorials blog has a new post mentioning the use of YAML structure for creating configuration files in your application.

YAML, or YAML Ain't Markup Language, is a "human friendly data serialization standard". It's essentially a very basic format for storing data, and uses far less syntax than standard PHP. [...] It's almost like English; it's as basic as you want. Of course, that's not to say it doesn't support complex structures - this example demonstrates the power of the format.

He also points out the spyc extension that makes working with the files in PHP a breeze.

0 comments voice your opinion now!
yaml config markup language configuration file spyc


International PHP Magazine:
Three Releases - Graphing, Blitz and Plugins
July 04, 2007 @ 09:47:00

The International PHP Magazine has links to announcements of three new releases of PHP-related applications - the PHP Advanced Graph and Chart Collection, Blitz Templates and the Generic PHP Plugins & Config System:

  • PHP Advanced Graph and Chart Collection 5.1 provides a very easy way to embed dynamically-generated graphs and charts into PHP applications and HTML Web pages
  • Blitz templates 0.4.19 Blitz templates is a fast template engine written in C and compiled as a PHP module. It started as a php_templates replacement, but developed into much more.
  • Generic PHP plugins and config system 0.75 Plugin meta descriptions can reside as human-friendly comment blocks in .php scripts. Generic PHP Config reads them and facilitates plugin and configuration setting management.
0 comments voice your opinion now!
application version release graph template plugin config application version release graph template plugin config


Joshua Eichorn's Blog:
Webthumb updates
July 20, 2006 @ 05:42:42

Joshua Eichorn has a new update on his Webthumb application he's mentioned before, noting some of the issues/updates that he's worked through so far.

Webthumb got off the ground yesterday without too many problems. It ran into problems right out of the gate since a large number of sites don't seem to want to finish loading correctly. I also updated the server config, Webthumb now supports flash (version 7), and has a lot more fonts installed so sites that need non-latin characters should be working correctly.

He's also laid out some "feature goals" that he'd like ot add in eventually, including better URLs, a searching method for thumbnails, and user accounts.

0 comments voice your opinion now!
webthumb update problems config flash7 new features webthumb update problems config flash7 new features



Community Events





Don't see your event here?
Let us know!


library language laravel update tips install interview zendserver package deployment api framework symfony series list community introduction podcast release opinion

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework