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

PHPMaster.com:
Explore Aspect Oriented Programming with CodeIgniter, Part 3
August 24, 2012 @ 11:56:29

PHPMaster.com is back with the third part of their series looking at Aspect Oriented Programming with the CodeIgniter framework. (Part 1, Part 2)

In the previous parts of the series we learned about AOP concepts and the need for using AOP in large scale projects and I introduced CodeIgniter's hooks as a convenient mechanism for creating AOP functionality from scratch. In this part I'll show you how to use both XML and comment-based techniques to create custom AOP functionality when a dedicated AOP framework is not available.

They start with the XML configuration that defines a few aspects and pointcuts for the application. This is then read in via the "applyBeforeAspects" and the aspects that should be executed first are extracted, loaded and run. Following this, they take the other approach - based on docblock comments - and pull in the comments (the @before and @after tags) and load/execute the aspects that way instead.

0 comments voice your opinion now!
aop aspectoriented programming tutorial xml docblock configuration


Antonin Januska:
How To Write Code Comments Well
August 20, 2012 @ 10:17:42

In this new post Antonin Januska shares some reminders about what good code comments should look like - what needs to go in and what needs to stay out (you comment all your code, right?)

Code organization is a huge thing, especially for developers (because they deal with code), and often times it's a philosophical debate as to how code should be documented, if spaces should be used instead of tabs, what kind of documentation should be used and so on. Yet, what no one brings up is the dire issue of COMMENTING. We can all agree that comments are essential (and sometimes used to build half-ass documentation on big systems) but what no one really mentions is the fact that people are crappy commenters.

There's two topics he touches on that (surprisingly) it's easy for developers to forget when writing their code - "be informative" and "use consistent formatting". A lot of the issues could be helped if developers made more use of DocBlock formatting which many IDEs already have support for.

0 comments voice your opinion now!
code comments opinion docblock formatting informative


PHPMaster.com:
Generate Documentation with ApiGen
August 02, 2012 @ 09:44:43

On PHPMaster.com today there's a new tutorial showing you how to generate API documentation with the help of the ApiGen documentation tool and some commenting in your code.

If you're writing undocumented code, you should stop this very moment. I'm serious. Drop everything, save and quit, and focus on improving this essential part of your workflow. [...] ApiGen is a docblock parser like PhpDocumentor. PhpDocumentor has been around for much longer than ApiGen, but unfortunately its development is somewhat stunted and it lacks in terms of modern documentation and examples.

He shares an example class, fully commented to show off the right way to handle the DocBlocks and goes through each of the "@" types and explains what they're for. Also included are the instructions for getting ApiGen installed (via the PEAR installer) and a sample command to generate the docs from the source. You can find out more about ApiGen and some of its other options on it's main site.

0 comments voice your opinion now!
api documentation tutorial apigen docblock parse tool


Andrew Eddie's Blog:
Making the most out of Code Assist in Eclipse/PDT and Zend Studio for PHP
December 01, 2011 @ 12:55:32

Andrew Eddie has posted a helpful tutorial for Eclipse users out there showing how to get the most our of code assist in Eclipse PDT/Zend Studio.

One of the powerful features of an IDE like Eclipse is the ability for it to "read" your code and give you some assistance about your API as you type. This could include things like class property or methods names, constants, functions, argument lists, and so on. Eclipse/PDT and ZendStudio do this by parsing a PHP class directly, but they also look at your docblocks and some other special comments where the raw PHP is not enough. This article is a bag of tricks that help you get the most out of code assistance using Eclipse/PDT or Zend Studio in those awkward corners of your code that you might have through previously inaccessible.

Among his tips are things like adding "@var" declarations to help with code completion, type hinting on methods/functions, using the "@property" annotation and using a "this" trick to override what class the IDE sees as the local object. ,/p>

0 comments voice your opinion now!
eclipse zendstudio ide hint trick docblock annotation codeassist


Tales of a Coder:
DocBlox - Pain Free Documentation
December 01, 2011 @ 09:56:27

On the Tales of a Coder blog there's a recent post about DocBlox, an alternative to the usual phpDocumentor for generating automatic documentation, and how it made it "pain free" for her current project.

Want to generate documentation for your PHP project, but keep putting it off? Can't be bothered wading thigh deep in documentation, screaming WHY WON'T IT WORK as you try to set it up? Look no further. DocBlox is pain free and you'll be up and running, literally in a few minutes.

She includes a guide to getting the latest DocBlox installed and configured to work with your project. The configuration is a straight-forward XML file, so changing the settings to match your needs is easy (more on the config here). Once this is configured, building your documentation is one command away. For more details on DocBlox, check out the project's website.

0 comments voice your opinion now!
docblox phpdocumentor painfree documentation docblock tutorial


Karsten Deubert's Blog:
Zend_MVC, Controller Plugins and Annotations
November 28, 2011 @ 12:02:50

Karsten Deubert has a recent post to his blog looking at annotations in Zend Framework applications to enhance functionality already in the framework.

Recently I had the idea to influence Controller Actions with annotations but discarded it with thoughts like "In PHP I will have to use reflection and some black magic to get this working which will have insane performance hits for my applications"... until I set everything up to see that it costs just 1-2ms in average per request without any form of caching.

He includes a few bits of code to show a simple annotation example (setting a layout) and the controller plugin that performs the translation. In his case, it's hard-coded to look for the "@layout" annotation in the docblock comment, but it'd be relatively trivial to extend it to a more full-featured version.

0 comments voice your opinion now!
zendframework mvc controller annotations docblock comment plugin


King Foo Blog:
Using Complex Type with Zend_Soap
September 23, 2011 @ 08:37:10

New from the King Foo blog there's a tutorial showing how to use complex types in a SOAP request with Zend_Soap, a component of the Zend Framework.

To be able to use complex types with Soap requests, they need to be fully defined in the WSDL file. Zend_Soap can automate this process, if you know how to define those complex types. Let us start without it Zend_Soap's magic and compare it with a fully discovered complex request type afterwards.

In their example, they have a collection of books (objects) that they want to send over to the web service. The code for both the server and client side are included with the WSDL automagically created by the Zend_Soap_Server component. By setting docblock comments on the properties of the Book objects, the SOAP components automatically know what types they are. Their example defines these, and sets up the web service on the other side with a classmap to define where the "tags" information for each book lies.

0 comments voice your opinion now!
zendsoap soap zendframework component autodiscover docblock


DZone.com:
There's no reason not to switch to DocBlox
September 01, 2011 @ 13:35:03

On DZone.com there's a recent post from Giorgio Sironi sharing his opinion on what should be your choice of automatic documentation generation tools in your PHP app, that there's no reason not to switch to DocBlox.

Alessandro Nadalin signals these three options for Api documentation generation, the process of extracting Api informations on classes and methods from a folder full of source code: phpDocumentor, doxygen and DocBlox. A PHP tool, faster than doxygen in implementing new features, and actively developed: these are the factors that made me choose DocBlox as my new default Api documentation mean.

He covers the installation of the tool (from its PEAR channel), some of the features it comes with, a link to their demo and some of his impressions after trying it out on his codebase.

0 comments voice your opinion now!
docblox docblock documentation opinion tool


Matthew Weier O'Phinney's Blog:
Using DocBlox
August 04, 2011 @ 08:08:36

On his blog today Matthew Weier O'Phinney has a new post looking at an alternative to some of the other PHPDoc-based documentation tools, DocBlox, a tool written in PHP.

Until a few years ago, there were basically two tools you could use to generate API documentation in PHP: phpDocumentor and Doxygen. [...] phpDocumentor is practically unsupported at this time (though a small group of developers is working on a new version), and Doxygen has never had PHP as its primary concern. As such, a number of new projects are starting to emerge as replacements.

He introduces DocBlox as one of these alternatives and points out where you can get the latest version (from one of many sources including github, PEAR or by just grabbing a release. He includes instructions on how to run the tool on your code, use it to identify missing docblock comments and how to use the class diagrams feature that gives a more visual sense of how things fit together. He also mentions changing the title of the output, using different templates and how it uses a local SQLite database to cache the parsed information about your code (making it simpler and faster to do updates in the future).

0 comments voice your opinion now!
docblox docblock comment parse introduction


Michelangelo van Dam's Blog:
Quality Assurance on PHP projects - PHPDocumentor
July 27, 2011 @ 08:51:48

Michelangelo van Dam has posted the latest in his "quality assurance in PHP projects" series today with a look at something that can make your life and documentation easier - PHPDocumentor.

Unfortunately I've come across too many lines of code that were just lines of code, no comments or annotations provided. So, in best cases I could guess the types and parameters, but in many it was too obfuscated. I already talked about usage of a code sniffer like PHP_CodeSniffer in my previous post where you can validate the usage of comments in the code. But forcing developers (using a pre-commit checker) into writing documentation with their code is not really a good thing.

He suggests using something like PHPDocumetor (there's other PHPDoc parsers including DocBlox and Doxygen out there) to automatically generate documentation for your code based on its comments, giving your developers easier web-based access to the contents. He includes some sample docblocks for a class/method and gives an example command line call to build docs based on a project. A screencast and screenshot of the generated site shows the results of the run.

0 comments voice your opinion now!
phpdocumentor docblock parse quality assurance documentation



Community Events





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


zendserver podcast language release deployment voicesoftheelephpant bugfix framework package interview introduction symfony series opinion library install api laravel unittest community

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