Webpage Screenshots using PHP

I’ve always wondered about how to grab screenshots of web pages through PHP and other languages, but without utilizing a real browser. I believe that previously, running multiple machines on a network was the easiest though logistically difficult solution.

But thanks to a project named wkhtmltopdf, it can now be done with minimal configuration and programming. Using the Linux shell and some PHP scripting via the snappy library, taking screenshots of web pages aren’t so hard at all.

Image charts using PHP

chart

pChart is a PHP library that will help put nice graphical charts in your applications. And the best thing about pChart is that it’s free unlike other similar solutions. Another advantage is the quality of the generated graphs that puts non–free solutions to shame.

I’m sure this will come in handy for future PHP projects.

WordPress 2.3.1 released

The update to the 2.3 version of WordPress is now available for download, containing fixes to the previous release. Interestingly, load order for the JavaScript libraries Prototype and JQuery are fixed to prevent compatibility issues, which brings me to my point — why use both libraries?

Prototype and JQuery are not small code libraries, and in a way are frameworks for simplifying client–side scripting. However, many of their uses can be achieved utilizing either of the two libraries, so the need to use them both simultaneously is rather redundant, and may be unnecessary. I think in the next major releases of WordPress, one of these two will be left out.

Inspekt: Sanitize PHP Superglobals

Working with PHP’s $_GET, $_POST, and $_COOKIE can be daunting especially when dealing with various magic quotes configuration, etc. More importantly, these superglobals are also subject to SQL injections and other hack attacks. Good thing there’s Inspekt — a PHP class that puts these variables in a “cage” and sanitizes them. Accessing the specific variables that you need is done through specified methods, returning safer values, containing only what you need.

JQuery 1.2

JQuery logo.

Yes, JQuery 1.2 is out. If examples around the web and our previous coverage didn’t entice you enough, this one should:

JQuery UI logo.

jQuery UI signals the start of a whole new branch of the jQuery project which will focus on developing high-quality, reusable, components that you’ll be able to drop in your applications. Frequently, these components are coming directly to you from traditional jQuery plugins, but with strict coding, documentation, themeing, and demo standards. We hope you’ll enjoy this new level of quality as much as we do.

Good stuff.

jQuery 1.1.3.1: Faster yet still without the fats

The jQuery developers have just released an update, version 1.1.3.1, which it claims to have significant speed improvements over the previous one. With several bug fixes and improvements, the package is reportedly 800% faster than before, a huge performance jump if their metrics are indeed accurate.

jQuery has slowly grown in adoption rate as more projects are now considering it as an alternative to Prototype, an equally powerful Javascript library. With point releases that come often and significant improvements, the package is now becoming a common part of most open source projects, perhaps attributed to its ease of use compared to other libraries.

Zend Framework 1.0 now available!

Earlier this month, Zend has released version 1.0 of their Zend Framework, their first production release. Some of the notable features of this robust development framework:

  • Powerful MVC framework
  • Database access solution that balances ORM with efficiency and simplicity
  • Lucene-compatible search engine
  • Advanced I18N support
  • Robust authentication/authorization classes and input filtering
  • Rich web services client interfaces, including Google Data APIs and StrikeIron
  • Many other useful classes to make you as productive as possible
  • Thorough and high-quality test suites and documentation
  • Open-source development process with an active community provides continuous review and testing

Claiming to be the best suited PHP5 framework for meeting business needs, ZF should make significant headway into widespread use considering it can leverage its direct link to PHP itself, similarly a product attributed to Zend itself. The question though is will ZF be able to eat into the Ruby on Rails crowd?

JQuery 1.0

The javascript abstraction library JQuery which we mentioned several months ago has now reached version 1.0. Javascript libraries have been gaining popularity with the emergence of “Web 2.0” and JQuery is another useful tool. This one tries to simplify the way javascript code is written, allowing for simpler coding.

Libraries like JQuery do help in rapid web development, though there are arguments against multi–layered abstractions since it teaches nothing new to the developers that use them. But certainly, they do have their uses in programming if used properly.

Fighting comment spam with Akismet

Every web 2.0 builder is most likely exposed to comment spam because of the social nature of this generation’s web applications. This requires considerable effort in building a system that is not easily gamed by spammers, to avoid it being rendered useless by nonsense content.

Aside from email, comment spam is the next most prevalent form of spamming. This is largely because of the nature how google ranks pages through its PageRank algorithm.

Automattic’s Akismet has been one good weapon against comment spam since its inception as WordPress’s spam blocking mechanism. Thanks to its useful API, you can now use Akismet to check your comments against their spam–fighting magic from any PHP4–based system, using this PHP class from Pablotron.org.

10 PHP frameworks

This quick overview of ten of the more popular PHP development frameworks should help you in choosing the right one for your next project, based on your requirements. With the emergence of new methodologies and techniques, PHP frameworks continue to grow in number and complexity. This list can narrow down your choices to a lesser number, allowing you to evaluate your candidates more effectively.

Honestly though, I’m not a fan of frameworks for every type of development. There are PHP applications better done in a hack-and-slash way, especially those of the single–page, throwaway type. For small–scale apps, utilizing templating and database abstraction does the job, more often than not. Coupled with your favorite PHP classes and code libraries, development can be much faster and easier with careful planning, and application of simple “getting real” concepts popularized by 37signals.

cssQuery

cssQuery is a javascript library that provides an easy way to access DOM elements, without the need for focusing too much on transversing the document’s elements. More developers are more adept in CSS than in Javascript, making this a useful tool for those fairly proficient in CSS. cssQuery may be considered similar to jQuery and Behaviour, which somehow change the way we approach browser scripting.

Using cssQuery, you can now use common CSS selectors like body > p instead of getElementsById() or getElementsByTagName(). The downside would be the library’s size, though that is slowly becoming less of a consideration as broadband rapidly becomes widespread.

jQuery

I just came across jQuery, dubbed as “New Wave Javascript.” Going through their documentation and tutuorials, it appears that jQuery attempts to change the way people write javascript, an abstraction layer of sorts. This can be helpful for rapid development, enabling various client–side scripting capabilities with just a few lines of code. Unfortunately, I think the effort made in learning jQuery can be devoted to learning Javascript, a skill you’re supposed to learn anyway if you’re into web development. But then again, learning a new library for your scripting arsenal will increase your stock.

A few good libraries

AJAX libraries.

I’ve been looking at several AJAX libraries these past few days for use with iPAP and several other planned projects. Going through AJAX Matters’s list leads us to many projects and options, and finding the right one for a specific need can be a cumbersome task. I’m providing some insights for the ones I find good enough.

  1. XAJAX is PHP–based and generates the Javascript programatically. You need to designate the action executed like replacing or appending content, but there is minimal need for tinkering with Javascript at all. Unfortunately, modifying or altering the generated client–side code is not as straightforward as other libraries. Another plus is that the PHP functions and custom functions you need can be in the same page you’re displaying to the user, so all you need to do is include() the xajax class file. XAJAX is good for PHP developers seeking to add some AJAX functionality to their applications, but those with a healthier Javascript/DOM acumen would find the next two libraries friendlier.
  2. advAJAX recently made the digg frontpage and proves to be simple yet easy to customise. If you’re comfortable coding Javascript, you can mix and match advAJAX with other presentational libraries and you’d have your very own toolset for your application.
  3. SACK is last on this list, but definitely not on functionality. In fact, it is good enough that an earlier version is used in WordPress 2.0 for all its AJAXy goodness. Just like advAJAX, you can customize your Javascript to perfection. The difference is in the syntax for setting parameters and calling functions, and boils down to personal preference.

To summarize my observations, XAJAX is best for those familiar with PHP who’d rather not deal with too much Javascript. advAJAX and SACK are better options for Javascript hackers who need the customization possibilities.

moo.fx

If you’re looking for an easy to use effects library for your web application, moo.fx could be what you’re looking for.

moo.fx is a superlightweight, ultratiny, megasmall javascript effects library, written with prototype.js.

It’s easy to use, fast, cross-browser, standards compliant, provides controls to modify Height, Width, and Opacity with builtin checks that won’t let a user break the effect with multiple crazy clicks. It’s also optimized to make you write the lesser code possible.

Using this library is a simple task, and can take your web application interaction to higher levels.

AJAX Classes

AJAX is one of the primary ingredients for almost all Web 2.0 applications. This allows better interaction and feedback between the application and the user, allowing for an enhanced usability and user experience.

These AJAX PHP classes over at PHP Classes will surely help in providing the functionality for your web applications.