As a php web developer, you should know that php is probably the language that has the biggest code repository. So no matter what module you want to include in your project there should be an open source solution.
This can help in various ways, but just in case you can’t think of one, here I put a few :
- Open source is worked by many people, so the result is for sure better than one man’s work
- You can have free updates to your code, while otherwise you should code the updates each time something new comes up
- You save development time while your project is getting better
Anyway, after many years as a web developer, I’ve compiled a list of php classes that can be easily integrated in any project and I am regularly use.
Sending emails is something very common for every web site. Php’s mail() function is good for this, but what if you want to attach a file, or send through an SMTP server, etc? Well in that case you should use phpmailer
Another common module is the user module. With that you can manipulate users (login, logout, register, etc.) Personally I’ve never found a project that is good enough, so I created my own.
Php user class is a module that can be used even in established projects, as it uses variable data for database tables, fields, session variables, etc.
Fetching RSS Feeds
Ever wanted to fetch an rss feed from your project? Well there is always an easy way to fetch a feed but in most cases you need more than that. When that is the case you should definitely use Magpie RSS .
Another thing that all sites use is a template. A template engine can save you lots of time, while it can make display changes very easy. A complete template engine that most projects use is Smarty.
BBcode used to be a functionality for forums, but as more and more sites use it in order to be more friendly to their users, you might want to use BBcode to your site. The problem is that BBcode requires a lot of coding and I am not sure if you have the time for this. If you don’t you’ll find StringParser_BBcode class very useful.
Paypal Payment Integration
As you may know paypal has a nice API for developers who want to integrate paypal payments in their sites. The paypal IPN integration class helps you make use of it and start accepting payments in 20 minutes.
Often, an inexperienced PHP developer will hop onto IRC and ask a question in ##php on Freenode. And if the question is trivial, the answer seems obvious or they simply seem like a newbie, they may soon find themselves bombarded with such comments as “RTFM”, “Go learn PHP”, “We are not your personal tutors” or simply “You need to become a better PHP developer”. So, how is it that one becomes a better PHP developer? In this post, I’ll outline five ways to be a better developer, improve your productivity, write less code and achieve more with your web applications.There’s always more to learn when it comes to PHP development. New core functions, new frameworks, new design patterns, new code documentation styles. Here are some of the best ways you can become a better PHP developer.
1. Read the manual
I really can’t emphasize this enough – there’s a lot to be learned just reading the PHP manual. Especially check out the string and array functions. There’s a lot of functionality available right there, and often by reading through the manual you’ll find you’ve been reinventing the wheel in past projects when you could have just used a core function. The manual is your friend.
2. Browse through some code
PHP has a lot of open source code out there. So why not learn from it? Download an open source PHP application and have a read through the code. The bigger projects are probably better, as they’ll have more complex structures and systems in place but also more thorough documentation explaining it all. Check out SourceForge.net if you can’t find a good place to start.
3. Learn a new framework
There are more PHP frameworks out there than you’ve had hot dinners; a lot of them are open source and available online if you know where to look. Try the major ones first – phpframeworks.com has a good list. Your framework can never be entirely complete, your next job may require a different framework and you might just find the functionality of another comes in handy in one of your projects.
You’ve probably heard a lot of terminology and discussed in the context of PHP web development. From OOP to MVC, KISS to DRY, YAML to INI, even REST to XML-RPC, there are hundreds of technical concepts out there that could directly relate to your work. You may have formed a basic understanding of them, but do you really know what they are or what they mean for you? Spend some time doing real research; Wikipedia is a good place to start. You’re bound to learn something new.
5. Learn OOP
Maybe this follows on a little from the previous point, but OOP is more important than you think. Do you really know about PHP5’s implementation OOP? For example, are you familiar with abstract classes, interfaces, the implements keyword, static methods and properties, the ‘protected’ access modifier? Even many experienced PHP developers fall down in this area. If you make use of the features of OOP, you could save yourself a lot of development time.
So there you have it. Five, straightforward yet significant ways to be a better PHP developer.
When you start to learn PHP programming you will need an editor to write your code with and there are plenty of them out there for you to choose from and use.
In this tutorial I am going to list some of the most commonly used PHP editor tools and some information about them. Hopefully any new coders can then try out some of them and decide on what is best for them.
First of all NotePad++ is completely freeware .
Some Features :
- Auto-completion (language and file)
- Syntax highlighting (and brace and indent highlighting)
- Regular expression find and replace
- Split screen editing
- Spell checker (built in but requires Aspell)
- Hex editor (plug-in available, no longer included in standard installation as of v4.8.2)
- Tabbed document interface
- FTP Browser (plug-in included in standard installation)
- Support for various file formats including unicode.
EditPlus is a text editor, HTML editor and programmers editor for Windows. While it can serve as a good Notepad replacement, it also offers many powerful features for Web page authors and programmers.
Some Features :
- EditPlus supports powerful and customizable syntax highlighting for the a lot of programming launguages.
- FTP commands for uploading your local files to FTP server or for editing remote files directly.
- Line number, ruler, column selection, powerful search and replace, multiple undo/redo, spell checker, customizable keyboard shortcuts, and more.
The PDT project provides a PHP Development Tools framework for the Eclipse platform. This project encompasses all development components necessary to develop PHP and facilitate extensibility. It leverages the existing Web Tools Project in providing developers with PHP capabilities.
Some Features :
- Intuitive and easy to learn
- Seamless integration with the Web Tools project
- Adherence to Eclipse standards
- Continuous support of PHP developments
There are literally hundreds of editors out there for coding in PHP and what works for you is a matter of personal choice.
I have focused on Windows platform editors here, however there are many great applications on other platforms.
http://en.wikipedia.org/wiki/List_of_PHP_editors is a good place to start if you are not running on Windows and there are some further applications for each platform here that I implore you to explore.
Consider the following extract from a PHP-driven web page that displays the current date :
Today is <?php echo date (' j F Y '); ?>
The <? php tag tells PHP that everything that follows is program code rather that HTML, until the closing ?> tag. In this example , the echo command tells PHP to display the next item to screen; the following date command produces a formatted version of the current date, containing the day, month, and the year.
in this blog i will use defualt tag <?php …. ?> , but other tag styles can be used, so you may come across other people’s PHP code beginning with tags that look <? ( the short tag), <%(the ASP tag style or <script language=”php”> (the script tag).
Of the different tag styles that can be used, only the full <?php tag and the script tag are always available. The others are turned off or on by using a PHP configuration setting. We will look at the php.ini configuration file .
Anything that is not enclosed in PHP tags is passed straight through to the browser, exactly as it appears in the script. Therefore, in the previous example the Today is appears before the generated date when the page is displayed.
Your First Script
Before you go any further, you need to make sure you can create and run PHP scripts as you go through the tutorials in this blog. This could be on your own machine, and you can find the tutorial about installing the Apache server and mysql database system here .
Now go ahead and create a new file called time.php that contains this code :
<title> My First Script</title>
The time is <?php echo date ( 'H: i: s' ); ?> and the date is <?php echo date (' j F Y' );?>
now you can test you by typing this URL http://localhost/time.php
The time is 17: 20: 12 and the date is 1 December 2008
When referancing any external item, be it an included file in PHP, a CSS document in HTML, or an image, you have the choice of using either an absolute or relative path. An absolute path says where a file is starting from the root directory of the computer. Such paths are always correct, no matter the location of referencing (parent) file. For example, a PHP script can include a file using
Assuming file exists in the named location, the inclusion will work (barring any permissions issues). The second example, in case you’re not familiar with the syntax, would be a Unix ( and Mac OS X) absolute path. Absolute paths always start with something like c:/ or / .
A relative path uses the referencing (parent) file as the starting point. To move up one folder, use two periods together. To move into folder, use its name followed by a slash. So assuming the current script is in the www/ex1 folder and you want to include something in www/ex2, the code will be:
A relative path will remain accurate, even if moved to another server, as long as the file keep their current relationship.
I hope this tutorial was helpful. if you any have any question don’t hesitate to ask.
Dynamic Web sites are flexible and potent creatures, more accurately described as applications than merely sites.
Dynamic Web sites:
- Respond to diffrent parameters (for example, the time of day or version of the visitors web browser)
- Have a “memory”, allowing for user registeration and login, e-commerce, and similar processes
- Almost always have HTML forms, so that people can preform searches, provide feedback, and so forth
- Often have an interface where adminstrators can manage the site’s content
- Are easier to maintain, upgrade, and build upon than statically made sites