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

Andrew Podner:
Lithium Getting Stuff From Your Database
January 14, 2013 @ 10:36:31

Andrew Podner has a new post for those wanting to find out more about the Lithium framework and using models to work with your database.

Today I want to provide a tutorial on how to do some basic interaction with a database in Lithium, and I am going to rely on MySQL as a database for the purposes of this tutorial, although you have other options like MongoDB, as an example.

His example script uses the idea of "blog posts" stored in a MySQL table and code snippets are included showing how to:

  • Create the model class based off of the core Lithium one
  • Select all of the records from the table
  • Filter down the returned values with "magic finder" methods (like "findAllByStatus")

You can find out more about the framework in the project's documentation section of their site.

0 comments voice your opinion now!
database orm model find tutorial mysql


DZone.com:
Development Setup for Neo4j and PHP Part 2
August 02, 2012 @ 10:11:10

On DZone.com today they've posted the second part of their series looking at using the Neo4j database from your PHP applications.

This is Part 2 of a series on setting up a development environment for building projects using the graph database Neo4j and PHP. In Part 1 of this series, we set up unit test and development databases. In this part, we'll build a skeleton project that includes unit tests, and a minimalistic user interface.

The post includes the code to create the testing harness, a bootstrap file and a basic test to handle the checks on deletion of an "Actor". The rest of the post shows how to use the connection to find an Actor based on input from the user via a form.

0 comments voice your opinion now!
tutorial neo4j series setup unittest actor find


Sean Coates' Blog:
Use `env`
May 21, 2012 @ 11:58:34

Sean Coates has posted a reminder for PHP developers (and really anyone executing command-line scripts) to use "env" instead of hard-coding the path to the PHP interpreter.

These [support] scripts often run PHP in Gimme Bar land, and we make extensive use of the shebang syntax that uses common Unix practice of putting #!/path/to/interpreter at the beginning of our command-line code. Clearly, this is nothing special -lots of people do exactly this same thing with PHP scripts. One thing I have noticed, though, is that many developers of PHP scripts are not aware of the common Unix(y) environment helper, env.

The "env" alias makes use of your currently defined include path to track down a PHP binary to use to execute the script. Since there's only a "best practices" approach to places to put PHP on a server, the "env" usage makes your script more portable and it's one less thing to remember to change.

If you distribute a PHP application that has command-line scripts and shebang lines, I encourage you to adopt the practice of making your shebang line "#!/usr/bin/env php". Note that this doesn't just apply to PHP of course, but I've seen a definite lack of env in the PHP world.
0 comments voice your opinion now!
env environment include path find executable shebang


Stefan Koopmanschap's Blog:
GlobIterator Easy access to specific files
April 17, 2012 @ 12:43:42

Stefan Koopmanschap has a new post to his blog showing a handy use of the GlobIterator to access only certain files.

For a project I am working on I needed to iterate over all .xml files in a specific directory. I started out with a DirectoryIterator, then considered I didn't want the XML filtering to take place inside my foreach loop. I decided to add a FilterIterator to the setup, but then felt this was not the right solution either. So I turned to my favorite SPL guru, Joshua Thijssen, to see if I was overseeing some kind of filter-option in the DirectoryIterator. I didn't, but I did oversee something else: GlobIterator.

The GlobIterator lets you use functionality similar to the glob function (including being able to use wildcards in file searching) and get the resulting list back as a set of SplFileInfo objects, complete with additional metadata that can be extracted.

0 comments voice your opinion now!
globiterator spl iterator glob filesystem find


Sharon Levy's Blog:
PHP Version
January 05, 2012 @ 13:20:40

Sharon Levy has a new post to her blog showing a trick she's come up with to show the PHP version information (usually found in the phpinfo) even when it's disabled.

Sometimes the most crucial, basic piece of information can seem so hard to find. For example, suppose you wanted to find out what version of PHP your remote webhost provides to shared hosting users? What would you do? [...] For development purposes it can be helpful having phpinfo() available, but on a live shared host, you may discover as I did recently that it is no longer available; your host may have disabled it.

She includes three other ways you can use to get the version of PHP you're working with:

  • If you have command line access, running "php -v"
  • Using the phpversion function (or PHP_VERSION constant)
  • Appending a certain value to the URL (only works in some cases)
0 comments voice your opinion now!
find version language method phpinfo phpversion url


PHPClasses.org:
Talented Web Developers Are Easy to Hire, Employers Are Just Not Looking Right
November 30, 2011 @ 09:57:05

A new post on the PHPClasses blog today suggests that good, talented web developers are actually pretty easy to find, you just have to look in the right places.

Once in a while, we hear company managers and recruiters complaining about how hard is to find talented Web developers that are willing work for them. The problem is that they are not looking right. Not only there are plenty of talented Web developers out there, they are easy to find, and many of them are available for hire.

The key point in his "easy to find developers" argument is simple - be open to telecommuting. Too many companies shun it because of the lack of control it brings to a group, but it also shuts down so many possibilities. He offers a few of his own reasons for the hesitation: the need to see the employee frequently, security concerns and trust issues. He also includes a few of the success stories of PHP community members who telecommute including Eli White, Ernani Joppert and Arturs Sosins.

0 comments voice your opinion now!
find developer company telecommute opinion


PHPBuilder.com:
PHP Simple HTML DOM Parser Editing HTML Elements in PHP
September 08, 2011 @ 10:06:07

On PHPBuilder.com today there's a new tutorial from Vojislav Janjic about using a simple DOM parser in PHP to edit the markup even if it's not correctly W3C-formatted - the Simple HTML DOM Parser

Simple HTML DOM parser is a PHP 5+ class which helps you manipulate HTML elements. The class is not limited to valid HTML; it can also work with HTML code that did not pass W3C validation. Document objects can be found using selectors, similar to those in jQuery. You can find elements by ids, classes, tags, and much more. DOM elements can also be added, deleted or altered.

They help you get started using the parser, passing in the HTML content to be handled (either directly via a string or loading a file) and locating elements in the document either by ID, class or tag. Selectors similar to those in CSS are available. Finally, they show how to find an object and update its contents, either by adding more HTML inside or by appending a new object after it.

0 comments voice your opinion now!
simple html dom parse tutorial selector find replace edit


Josh Adell's Blog:
Path finding with Neo4j
June 28, 2011 @ 12:38:01

In a follow up to his previous post on using Neo4j with PHP, Josh Adell looks in a bit more detail about how to find paths in the data via a REST interface to the database.

The thing that makes graphing databases useful is the ability to find relationship paths from one node to another. There are many algorithms for finding paths efficiently, depending on the use case.

He includes some code showing the REST request (made via this client) to fetch these street-based relationships. He then creates a little sample script that provides driving directions from one intersection to another with a "findPathsTo" call. He modifies it a bit later on to use the Dijkstra algorithm.

0 comments voice your opinion now!
path find neo4j graph database tutorial rest client


Cal Evans' Blog:
How do I find good PHP developers?
September 14, 2010 @ 12:22:14

If you or your company is looking to hire on PHP developers but are having trouble finding good, qualified people, you should check out some of the advice that Cal Evans has posted to his blog to help you out.

Twice this week I got asked a similar question, "How do I find good PHP developers to hire?" The first one was a recruiter who had originally tried to hire me because she "read my resume". [...] The second one, however, was a just someone trying to find PHP developers for his team. Since he wrote me a nice email asking advice, I decided to reply in kind. Three pages and one thousand words later, he had my answer.

His answer included seven different points companies/recruiters could possibly follow to help them get the right people on board:

  • posting jobs on phpdeveloper.org (yes, shameless self-promotion)
  • PHP User Groups
  • Getting involved in the community
  • Considering telecommuters
  • Attending conferences
  • Getting your developers to write about your company/work environment
  • Do things that make your developers want to sing your praises
0 comments voice your opinion now!
find good developers recommendation opinion


Fabien Potencier's Blog:
Find your Files
April 22, 2010 @ 14:45:09

Fabien Potencier has a new post today about an update he's made to an aging bit of code for the Symfony framework to find files on the local filesystem - sfFinder.

I used the opendir, readdir, and closedir native PHP functions, and it did the job quite well. The PHP class was named sfFinder, and it can still be found in all symfony versions. Even if the class is bundled with symfony, I know that a few people use it for all kind of stuff, not necessarily related to symfony. But the code starts to show its age; first because I learned a lot since then about PHP, and also because there is a better way now. Enter iterators!

He shows an example of how to use Iterators to search through directories recursively (RecursiveDirectoryIterator) and locate a certain filename. He also looks at making it more OOP and including filtering to remove files from the search. He's packaged up some of this logic into a new Symfony component - the Finder component - that can be used to locate files in a path, be restricted to a depth for the search, match regular expressions file names, filter by file size and much more.

If you'd like to dig into the code, check out this page on github for this new component (PHP 5.3 only).

1 comment voice your opinion now!
find file symfony component finder iterator



Community Events





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


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

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