What is FuelPHP?
FuelPHP is a simple, flexible, community driven PHP 5 web framework. It was born out of the frustrations people have with the current available frameworks and developed with support from a community of developers. FuelPHP is extremely portable, works on almost any server and prides itself on clean syntax. (FuelPHP doc) or
FuelPHP is an open source web application framework written in PHP which implements the HMVC pattern. FuelPHP is a MVC (Model-View-Controller) framework that was designed from the ground up to have full support for HMVC as part of its architecture. But we didn’t stop there, we also added ViewModel into the mix which give you the option to add a powerful layer between the Controller and the View. FuelPHP also supports a more router based approach where you might route directly to a closure which deals with the input url, making the closure the controller and giving it control of further execution.
What are the features of FuelPHP?
- An (H) MVC framework
- Oil: the power of the command line interface
- Base classes for Controllers and Models
- Inbuilt Authentication
- Modular and extendable to a fault
- Multiple template parser for your Views
- Complete Flexibility: One of the many benefits of Fuel is that there are very few restrictions on how to write code.
- Community Enthusiasm :Just like CodeIgniter framework, FuelPHP is huge community driven framework used for web development.
- Powerful yet lightweight ORM: This package gives a chance for one module in the new application and ended up using it for every module so far.
- Inbuilt Security modules: Out-of-the-box FuelPHP’s Views will encode all output to make it secure and prevent XSS attacks.
What to look forward to in Version 2.0 FuelPHP?
The next major release of the framework. It brings significant improvements but also makes some changes to the way the framework functions.
- Global scope and moving to dependency injection
- Singleton
- Multiton
- Dependency injection container
- Coding standards
- Package management and modularization
- Backwards compatibility
- Speed boosts
Can you explain HMVC?
HMVC (Hierarchical Model-View-Controller) is an evolution of the MVC pattern used for most web applications today. It came about as an answer to the salability problems apparent within applications which used MVC. FuelPHP provides an option to call one controller from another controller, similar to the request from the client (browser). If any controller calls another controller, the called controller will return the response to the calling controller instead of rendering it to the client (browser). This enables widgetization of the web application
What are advantages of HMVC pattern in FuelPHP?
Key advantages to implementing the HMVC pattern in your development cycle:
Modularization: Reduction of dependencies between the disparate parts of the application.
Organization: Having a folder for each of the relevant triads makes for a lighter work load.
Reusability: By nature of the design it is easy to reuse nearly every piece of code.
Extendibility: Makes the application more extensible without sacrificing ease of maintenance.
What is Scaffolding in FuelPHP?
In FuelPHP, Scaffolding is a meta-programming method for building database operations.
What is the use of Oil Package in FuelPHP Framework?
In FuelPHP, Oil package is used for installation, development and testing of application.
This will enable you to speed up your development by providing several functions:
Generate: Create MVC components, migrations, etc.
Refine: Run tasks such as migrate, and also your own customized tasks.
Package: Install, update and remove packages.
Console: Test your code in real-time using an interactive shell.
Testing: Run PHPUnit tests.
What are the types of Reserved Routes in FuelPHP Framework?
In FuelPHP, there are various types of Reserved Routes:
root_: The default route when no URI is specified.
_403_: It throws an HttpNoAccessException that isn’t caught.
_404_: It throws an HttpNotFoundException that isn’t caught.
_500_: It throws an HttpServerErrorException that isn’t caught.
What is Presenter and how to create Presenter in FuelPHP Framework?
A Presenter is a class that contains the logic. It is needed to generate our view. A Presenter should not do any data manipulation but it can contain database calls or any other retrieval.
To create empty Presenters:
classPresenter_Index extends Presenter
{
— Body —
}
What is PHPUnit?
FuelPHP framework integrates with the PHPUnit testing framework. To write a unit test for the FuelPHP framework, we need to set up the PHPUnit. If PHPUnit is not installed, then download and install it. We can confirm the availability of PHPUnit in our system using the following command.
phpunit –version
If PHPUnit is available, you will see the result similar to the following.
PHPUnit 5.1.2 by Sebastian Bergmann and contributors.
What are the web servers of FuelPHP?
There are following web servers of FuelPHP:
- WAMP (Windows)
- Microsoft IIS (Windows)
- LAMP (Linux)
- MAMP (Macintosh)
- XAMP (Multi-platform)
- Nginx (Multi-platform)
- PHP in-built development web server (Multi-platform)
What are the Uploaded files array in FuelPHP?
field :It is used Name of the form field
name: It is used Name of the file uploaded
type :It is used type of the file as defined by the browser
mimetype :It is used type of the file as defined by Upload class
file :It is used Fully qualified name of the temporary location of the uploaded file
filename :It is used Filename of the uploaded file
extension :It is used extension of the file uploaded
size :It is used size of the file uploaded in bytes
errors: It is used array of error having error code and message
error :It is used whether to set array errors with why the upload fails (in case of failure in upload)
Once the files are saved in the server, the result array will have the following information as well.
saved_to: It is used fully qualified path where the uploaded file was saved
saved_as: It is used name of the file that was saved
errors :It is used updated error array
What are the Upload classes in FuelPHP?
Upload class can be configured using separate configuration file,
fuel/app/config/upload.php. The important configuration entries are as follows −
max_size: It is used set the maximum size of the file to be uploaded. “0” refers unlimited upload size
ext_whitelist : It is used set allowed file extensions
ext_blacklist : It is used set disallowed file extensions
type_whitelist : It is used set allowed file types. For example, “text” for mime type “text/plain”
type_blacklist : It is used set disallowed file types
mime_whitelist : It is used set allowed mime file types. For example, “text/plain”
mime_blacklist : It is used set disallowed mime file types
prefix : It is used string to prefix in the filename while saving the uploaded file to the server
suffix : It is used string to suffix in the filename while saving the uploaded file to the server
extension : It is used extension of the uploaded file to be set
create_path : It is used whether to create the file path, if not available
overwrite : It is used whether to overwrite the existing file while saving the uploaded file
auto_rename: It is used whether to rename the file by adding a sequence number while saving the uploaded file
randomize: It is used whether to create a random 32-character name to save the uploaded file
What are the types of controllers in FuelPHP?
In FuelPHP, There are four types of controller:
- Base controller
- Template controller
- Rest controller
- Hybrid controller
What are the predefine events in FuelPHP?
In FuelPHP, there are various predefine events:
- app_created
- request_created
- request_started
- controller_started
- controller_finished
- response_created
- request_finished
- shutdown
How to use join with condition?
$queryObj = Services Model_Org::query()
->related(‘org’)
->related(‘profile_image’)->related( array( ‘comments’ => array( ‘where’ => array( array(‘visible’ , ‘=’ , ‘0’) )
) ))
->where (‘rating’,’!=’, ‘null’)
->order_by (‘rating’,’desc’)
->get ();
Can you explain Email Management?
Email functionality is the most requested feature in a web framework. FuelPHP provides an elegant email class bundled as a package. It is used to send simple plain text email as well as advanced rich text email with multiple attachments. It supports the following features – Plain-text mails, HTML mails, attachments, and inline attachments.
Can you explain Error Handling?
FuelPHP error handling is based on exceptions. FuelPHP provides PhpErrorException exception for all old php errors. FuelPHP raises PhpErrorException whenever an error in the PHP code is encountered. FuelPHP also makes it easy to display custom error pages for various HTTP status codes.
What are the pros and cons of FuelPHP?
Pros:
- It is Open source
- It Supports HMVC
- It is easy to use Submitted
- Caching is Optional · Authentication packages Restful building · URL routing
- Modular with integrated ORM
- New version will be fully object oriented, can be installed using composer, and one installation can
Supports multiple applications
- Fast and secure
Cons:
- Not very beginner friendly (slim support documentation)
- It is a relatively new framework with less support
- Open source Community contributions are less than others (like Laravel and Phalcon)