Showing posts with label php development. Show all posts
Showing posts with label php development. Show all posts

Friday, 26 December 2014

Why the Latest PHP 5.5 is Impressive on Ecommerce Stores?

LAMP (Linux/Apache/MySQL/PHP) platform is a successful alternative to commercial software for building and operating dynamic and high performance web systems. PHP has become one of the major player on the web development market in the last few years. For all Linux hosting packages, PHP 5.5 has recently become the standard version.

The upgraded PHP version 5.5 comes with lots of changes and value additions. Most of the changes are beneficiary for the e-commerce stores running on php.


Here’s a Brief description of what PHP version 5.5 has to offer your e-commerce store

1. Addition of keywords
In php version 5.5, the provided refinery keyword facility will allow a developer to define block code, cache block for better keyword search. It improves the result of the search based on keywords. Keyword search is very much helpful in the e-commerce online stores.

2. Availability of Generators

Availability of generators provides a way for iteration through the data. Because of which the function keyword will give the more appropriate results. In e-commerce online stores, it is important to get appropriate results for a particular search for keyword. Availability of generators in php version 5.5 provides this facility.

3. Class name resolution update

Updated class name resolution in the php version 5.5 provides easy and fast filtering through the class names. More options for the class name resolution and filtration in the updated php version. For e-commerce online stores more class name filtration gives better results.

4. Empty functions acceptability

Empty functions are used to determine the false or equal value false commands. Sometimes these empty functions won’t work properly and take the search result back to the original place. In php version 5.5, the acceptability of the empty function is improved. It won’t take the search result at initial position. In advanced version, the false value recognition is improved. It helps e-commerce online stores to get uninterrupted process of product selling after the false command entries. It helps the e-commerce online stores to gain more customers.

5. Security

Apart from core technical impact, the main impact of php version 5.5 is on security. This version makes the e-commerce online stores become more secure. For example, as Microsoft have decided to cut-off the support system of windows XP and other older versions, it is easy to crack the systems working with earlier. But it will not be an issue in php based systems as php 5.5 version does not function on the windows XP or older versions. So the firewall provided by the windows and security system of php will keep your e-commerce store intact.
For more information refer php.net

At CodeWebber, we offer comprehensive e-commerce development services to various SMEs and large scale businesses across the globe which help them offer their products and services vividly on the internet and outshine in the digital marketplace.

Source: CodeWebber


Tuesday, 16 December 2014

PHP Vs RoR- A Comparitive Study

PHP was built primarily as a server-side scripting language for web development and dynamic content and, it has been around since 1994. PHP code was originally embedded within the HTML code so that the content could change according to the needs of the coder. This too changed with the arrival of frameworks into the development world.

Ruby was first launched as a scripting language that was more powerful than Perl and more object-oriented than Python. Ruby was born in 1993, and its first public release came up in 1995. Although Ruby was older than PHP, only after having ties to Rails in 2005, did it really start gaining popularity.

PHP is a stand-alone language, whereas, Ruby on Rails is a language combined with a framework, therefore we can only analyze some of the general differences which are


 

Scaling

They are both equally easy or difficult to scale in different levels. The first level of scaling is just about adding more memory/cpu/server instances. Once this is done, they are both equally hard demanding all of the same methods as scaling any other web application on the internet.

Web hostin

PHP applications do have support from most of the web hosting companies, whereas Ruby on Rails is supported only by unix based server. On hosting front, PHP is an obvious winner. But with introduction of Heroku, ROR applications can be hosted easier.

Application performance:

  • Add New
There is no hiding the fact that PHP codes run faster than that of Ruby on Rails code. On the other hand, we can achieve tasks in RoR with few lines of code when put next to that of PHP coding. So, achieving tasks faster with few lines of code is the clear winner for me.

Frameworks:

On the framework front, there is no clear winner as both PHP and Ruby have good MVC architectural framework. PHP has more compatible frameworks like CakePHP, codeigniter and Zend. But, in Ruby too, apart from rails there are many good frameworks like Sinatra, vintage etc. So it is a tie when the comparison is about frameworks.

Testing:

Testing code and modules is a difficult affair in PHP. However, in Ruby on Rails with introduction of R-spec testing rails code is an easy cake for developers. Ruby on Rails development will be helpful in creating bug-free application. In CakePHP too you can do those testing, but, with certain code changes.

Code Structure:

RoR has a clear code structure when compared to that of PHP.

Memory:

PHP utilizes less memory space because by default they don’t have the overhead of a web framework. whereas Ruby on Rails would use more space. Hence, application based on Ruby on rails would be slower compared to that of PHP.

Syntax:

Both have syntax that is clear and simple. However, Ruby without ending syntax was not acceptable to many programmers. So the final conclusion is, if a client project already has existing PHP code and we’re developing for that, that is, integrating at the software level, we stay with PHP. Whereas, if a client needs a brand new application then we have a slight inclination towards using RoR. I am not saying that PHP is bad. Come on, you have already gone through the comparative study! Last but not the least, when CodeWebber builds a new app for our own needs, we use either PHP or Ruby on Rails. Happy PHPians?
At CodeWebber, we value your business.  Our team of experts are waiting for your query. CONTACT US!

Source: CodeWebber



Saturday, 13 December 2014

Bad CakePHP Habits & How to Rectify Them!

As a programmer we are always learning, so it is important to follow the best practices and adjust to them.

CakePHP Conventions
There are actually CakePHP coding conventions which should be followed. I will highlight a few things,

1) Control Structures.  So often you see programmers get this wrong, and in even some cases bring practices for other coding languages.  CakePHP expects the following syntax:

if ((expr_1) || (expr_2)) {
// action_1;
} elseif (!(expr_3) && (expr_4)) {
// action_2;
} else {
// default_action;
}

In the control structures there should be 1 (one) space before the first parenthesis and 1 (one) space between the last parenthesis and the opening bracket.  So this means that the following is incorrect:

if ($foo) {
$bar = true;
if ($action) {
$to = false;
}

The indentation needs to line up correctly.

I often hear programmers say “but I am too busy to make the code neat….” My response is – “trust me, neat code will stand the test of time”.  Writing code which isn’t readable will be a nightmare to come back to if you need to make a change in a few months.

Fat Models, Skinny Controllers

Good CakePHP code will have the logic in the model files. This takes a bit to get used to, but once mastered there is no looking back!  A controller file should be used for what it is intended for in the MVC pattern – controlling!  So use your controller file to handle user actions, while let the code logic go in the model file.



The default add function is as follows:

public function add() {
if ($this->request->is(‘post’)) {
$this->Post->create();
if ($this->Post->save($this->request->data)) {
$this->Session->setFlash(__(‘Your post has been saved.’));
return $this->redirect(array(‘action’ => ‘index’));
}
$this->Session->setFlash(__(‘Unable to add your post.’));
}
}

This controller action is fine for a simple add, but what would happen if you wanted to do things such as send an email to the admin when a post was added, or update another model association when a post was added.  This is additional logic, but this logic shouldn’t go into our controller file.

Instead we would write a function for this in our App.php model, perhaps something like this:

public function addPost($data = array(), $emailAdmin = true) {
$this->create();
$this->save($data);
// update any other tables
// send the email to the admin user
if ($emailAdmin) {
}
// if all is successful
return true;
}

This would then result in a small change to the controller action as follows:

public function add() {
if ($this->request->is(‘post’)) {
if ($this->Post->addPost($this->request->data)) {
$this->Session->setFlash(__(‘Your post has been saved.’));
return $this->redirect(array(‘action’ => ‘index’));
}
$this->Session->setFlash(__(‘Unable to add your post.’));
}
}

As you can see, the new action is actually one less line, because the $this->Post->create() has been moved to the model file.
This is a perfect, everyday example of where moving logic to the model file is a good idea – and it certainly makes for a much cleaner code base!

Source: CodeWebber

Thursday, 11 December 2014

Best Ways to Create an Awesome Web Application

Web applicationIt is an established fact that PHP is one of the most popular language for programming. Sometimes, the PHP developers are likely to rely on the language heavily and, as an end result many mistakes can occur in the plan. These five ways are here to help you to avoid the possible troubles of this kind-

Read the reports around the errors

The error reporting can be your electronic consultant. It will reveal the mistakes in programming, so you are able to correct them at once. Still if you ignore the reports, the errors are going to be visible for the site users through a similar error report plan. They will get acquainted with your site, including the truth you’d possibly want to hide.

The “Bad features” on the PHP shall be powered down

Wide range of features are there in PHP to make the life of the world-wide-web application developer less difficult. These PHP applications are classified as the real miracle from time to time, still some ones give the unwanted consequences at the same time. With their help the bugs can enter your script and also the secret data may be revealed. So secure your bad applications before you start working with this system.

The input will likely be validated properly

When you crave to protect computer data, try to confirm the input. In the event that you’re experienced developer, you most likely know what exactly shall appear on the input. With this you will end up sure the guests can get the access only to the approved information.

The cross internet site scripting attack can appear in the user input

The application can accept the input from the user. It may come in various forms towards web application. Ensure the users tend not to download some dangerous content of one’s site through your input. Keep your site secure.

The SQL Treatments shall not possibly be possible

The SQL Injection is a quite popular attack. To avoid it, it is advisable to check the inward bound data, so the characters common towards SQL script will not likely come though. Probably the most visible ones are classified as the single and double quotes.

Source : CodeWebber