Remember Me
forgot your password?

Mvc Development With Php in the Fuse Php Framework

Let's face it - there are a lot of development frameworks out there, especially for PHP. CodeIgnitor and CakePHP come to mind immediately as leading PHP frameworks, but in this article I'm going to give some compelling reasons as to why you should be doing your PHP development with the Fuse PHP Framework. Fuse is a Model/View/Controller framework for PHP.

1. FUSE is easy to get running

The installation scripts included with Fuse guarantee that you'll have a working install a few minutes after downloading.  Fuse was built so that PHP developers don't have to feel like they were learning an entirely different language in order to make use of the framework. The syntax and structure follow normal PHP conventions, and everything from the method names to parameter order was designed to be as intuitive as possible. Let's face it - everyone wants to use the newest, best, and most appropriate tool for the job. However, developers will often shy away from doing things differently because of the learning curve. They fear that introducing new technologies or methodologies will increase their project timeframe and decrease productivity. Fuse was built with a deadline-oriented mentality in mind: you can get started quickly, and you don't have to know every in and out of the framework to start building your project.

2. Data access has never been easier

Fuse's data modeling makes accessing your data easier than you ever thought possible. The management scripts will give you create, read, update, and delete access right off the bat, and customizing your queries is as simple as can be. Let's say you want to list your products, but also include their category_name, which lives in the product_categories table. In Fuse, all you have to do is open your ProductController and add this line:

public $list_options = array( 'include' => 'product_categories' );

That's it. Now when you iterate through your products, you can use the variable <{category_name}> in your template to display the category name for your product. Let's say we only want to display 20 categories? Try this:

public $list_options = array( 'include' => 'product_categories', 'limit' => 20 );

Fuse offers a whole slew of data methods just like these, and your queries can be as simple or as complicated as you need them to be. You will rarely have to write a query, but if you want to, Fuse even offers an object to take the headache out of writing queries . And, as always, if you just want to hand code a query the old fashioned way, Fuse will never stop you. A core principal of Fuse is that it's designed to aid the programmer, not force him or her into the methodologies that we've deemed best.

3. A simple but extremely powerful templating engine

Fuse contains its own robust, intuitive templating engine that allows you to truly separate your code from your presentation. As with everything else, the templating system was designed to be intuitive, and "designer friendly". Want to loop through the products we fetched above? Try this:

<{ITERATOR products}>
name: <{name}><br />
category: <{category_name}><br />
<br />
<{/ITERATOR}>

Want to apply a function to one of your fields? How about we only display the first 200 characters of our description:

<{ITERATOR products}>
name: <{name}><br />
category: <{category_name}><br />
description: <{ print(substr(description, 0, 200)) }>
<br />
<{/ITERATOR}>

Maybe our products can be in more than one category, and we want to fetch them? After adding a one line method to our Product model that looks like this:

public function get_categories() {
return $this->product_categories->fetch_all();
}

We can do:

<{ITERATOR products}>
Name: <{name}>
Categories:
<{ITERATOR get_categories()}>
<{name}>
<{/ITERATOR}>
<{/ITERATOR}>

Yes, <{name}> will know that when you're in the products loop, you want the product name and when you're in the product categories loop, you want the category name.


4. Searching your data has definitely never been easier.

Your client tells you that they want to be able to search records with any combination of title, date, description, id, and author. You know this is going to be an annoying task of using if/then statements to build a search query. Unless you're using Fuse, where you can do it all with a few lines of code. The FuseDataController object, which handles all of the wheeling and dealing your app does with the database, has builtin search capabilities that will automatically sanitize data, generate the search query, and maintain the search session across pages. All you have to do is tell it which fields a user can search on, and it's ready to go. You can search fields values directly, with wildcards on either side, between two date intervals, or even have Fuse automatically parse strings like "restaurant AND (mexican OR Thai)" simply by setting your 'filter_type' to 'parsed_boolean'.

5. Builtin management of photos for albums, user profiles, etc.

Let's say you're building a site that allows users to create a profile, add photo albums, then add photos to those albums. You're going to want several different sizes - a full sized image, a thumbnail for browsing, and a tiny thumbnail for a contact sheet type of display. You also want to watermark each image with your site's logo. This can be a pretty tedious task if you're not using the FusePhotoController, which should have you up and running in about a half hour if you're slow.

6. Simple but fully featured, scalable user management and ACL

A lot of sites need user authentication. I've seen a lot of custom implementation in my time, and because of the complexity of doing it right, mostly they rely on a very basic user scheme that allows little or no granularity or scalability when it comes to setting permissions. Fuse has a simple to implement, but fully granular and scalable user authentication and permissions scheme built right in. Need to associate users with groups that all have different permissions? No problem. Have a user who's in the "editors" group, but shouldn't have access to delete an article? Just add a restriction for that user. Need to set it up so that when a user tries to access a restricted page, they are asked to login, then redirected back to the original page on success? It's already done. Password encryption? SHA-1, MD5, and crypt() are all supported. I could go on. You can read about it on your own here

7. Integration with existing non-Fused projects

I mentioned above that Fuse endeavors to never prevent the developer from doing what he or she needs to do. If you have a project that's already done in standard, inline PHP, Fuse can go right alongside your existing code without upsetting any of the existing functionality. In fact, if you include the Fuse bootstrap in one of your existing php scripts, you can add Fuse functionality to that script without having to edit any of the existing code. I have several projects right now that were handed to me as inline PHP, and I put Fuse right on top of it without having to re-code a single line of the existing project. However, I can now use Fuse moving forward for new features and updated functionality.

Conclusion

There you have it. Just a selected list of reasons you should switch to Fuse. Today. For the project you're working on. Right now. Make things easier on yourself. I've introduced a lot of people to MVC development and Fuse and, without fail, every single one has said, after just one project, that they could never possibly go back to their old methodologies of inline scripting and manually writing every query. Comments welcome.

Jim Keller

Jim Keller has been working closely with Internet Technology for nearly a decade, and is currently the CEO of Philadelphia Website Design Firm Context Technology Solutions, an end-to-end provider of IT and Internet solutions in the Philadelphia area. Mr. Keller holds a Bachelor of Science degree from LaSalle University with a major in Information Technology and minors in Computer Science and Communication. Although his technical skillset is varied, ranging from Windows network administration to advanced database management, his primary focus is web application development. He is the creator of the FUSE application framework, which provides development tools and a structured methodology for use in rapid application development. Mr. Keller has worked on a wide range of projects in a variety of industries, and most often assumes the role of senior software engineer or project manager.

Rate this Article: 0 / 5 stars - 0 vote(s)
Print Email Re-Publish


Article Source: http://www.articlesbase.com/programming-articles/mvc-development-with-php-in-the-fuse-php-framework-611877.html
Add new Comment



Captcha

  • Latest Programming Articles
  • More from Jim Keller

php software development company

By: usha sharma | 08/07/2009
Professional Web Development Company phpmaestro provides custom website development web application development ecommerce website design and development services. Custom web application development services and professional website development at affordable rates from phpmaestro Company. www.phpmaestro.com is a php Application Development Shopping Cart for e-commerce stores. Our shopping cart software gives our client full control over your online shop its products design development prices sh

Hire ASP .Net Developers Hire Dedicated ASP.Net Developers Offshore ASP.Net Programmers

By: Arshad | 08/07/2009
Since the concept of outsourcing changed the economy of many countries it has been very clear that paying Indian development service providers is very much economical than funding an in-house private team. Analysis says that more than 50% of the cost can be saved by inking contracts with Indian IT service providers.

Windbg Minidump Tutorial:Setting up & Reading Minidump Files

By: Jeannie Lee | 07/07/2009
Windgb Minidump tutorial to set up and read minidump files (.dmp). Setting Symbol File Path. Output of Windbg command. windbg.exe -z [file path to minidump file.dmp] -c !analyze -v.

Javascript Validate Name Field

By: Jeannie Lee | 07/07/2009
Simple Javascript tutorial on validating a name field. Checks to see if there is a value in the name field with Javascript after the user submits a form.

Logo Design- The image creator!

By: Jhonny Sharma | 07/07/2009
Brand image is something that many consumers look for while buying a product. Brand image and brand positioning have become important concepts in the corporate world. When image building strategies are talked about, what tops the list is a creative logo design.

Design principles in logo

By: Jhonny Sharma | 07/07/2009
An element of balance is a mandatory aspect of design. A design is considered to be a great design when it incorporates all design aspects in the required proportion. The design principles are vital for any kind of design.

Organization specific software

By: Manish Shrivastava | 07/07/2009
Different businesses have different technological needs depending upon the type of work they are engaged in. Some businesses might require minimum use of software technology where there might be others whose very business might depend upon the optimum use of technology.

Hire .Net Developers: Hire ASP.Net Programmers

By: Arshad | 07/07/2009
Since the concept of outsourcing changed the economy of many countries it has been very clear that paying Indian development service providers is very much economical than funding an in-house private team. Analysis says that more than 50% of the cost can be saved by inking contracts with Indian IT service providers.

Marketing in a Troubled Economy: Why You Should Focus on the Web

By: Jim Keller | 10/02/2009 | Online Promotion
Jim Keller of Context discusses why an upgrade of a company's web presence may be the most cost effective means of marketing in a time when budgets are already stretched too thin

How to Search Engine Optimize (seo) a Website

By: Jim Keller | 23/01/2009 | Online Promotion
Jim Keller of Context discusses how to go about optimizing your site so that it can be found on Google and other search engines when they are queried for specific keywords and phrases

An Introduction to Search Engine Optimization

By: Jim Keller | 19/01/2009 | Online Promotion
Jim Keller of Context discusses the fundamentals of search optimization, an integral part of marketing any website in order to increase its rank in search engines such as Google or Yahoo.

Submit Your Articles Free: Signup


Article Categories




Use of this web site constitutes acceptance of the Terms Of Use and Privacy Policy | User published content is licensed under a Creative Commons License.
Copyright © 2005-2008 Free Articles by ArticlesBase.com, All rights reserved. (0.23, 1)