Thursday, January 7, 2016

10 PHP Frameworks For Developers – Best Of

PHP, known as the most popular server-side scripting language in the world, hasevolved a lot since the first inline code snippets appeared in static HTML files.
These days developers need to build complex websites and web apps, and above a certain complexity level it can take too much time and hassle to always start from scratch, hence came the need for a more structured natural way of development. PHP frameworks provide developers with an adequate solution for that.
In this post we carefully handpicked 10 popular PHP frameworks that can bestfacilitate and streamline the process of backend web development.

Why Use A PHP Framework

But first, let’s take a look at the top reasons why many developers like to use PHP frameworks and how these frameworks can level up your development process. Here’s what PHP frameworks do:
  • Make speed development possible
  • Provide well-organized, reusable and maintainable code
  • Let you grow over time as web apps running on frameworks are scalable
  • Spare you from the worries about low-level security of a site
  • Follow the MVC (Model-View-Controller) pattern that ensures the separation of presentation and logic
  • Promote modern web development practices such as object-oriented programming tools

1. Laravel

Although Laravel is a relatively new PHP framework (it was released in 2011), according to Sitepoint’s recent online survey it is the most popular framework among developers. Laravel has a huge ecosystem with an instant hosting and deployment platform, and its official website offers many screencast tutorials called Laracasts.
Laravel has many features that make rapid application development possible. Laravel has its own light-weight templating engine called “Blade”, elegant syntax that facilitates tasks you frequently need to do, such as authentication, sessions, queueing, caching and RESTful routing. Laravel also includes a local development environment called Homestead that is a packaged Vagrant box.
Laravel

2. Symfony

The components of the Symfony 2 framework are used by many impressive projects such as the Drupal content management system, or the phpBB forum software, but Laravel – the framework listed above – also relies on it. Symfony has a wide developer community and many ardent fans.
Symfony Components are reusable PHP libraries that you can complete different tasks with, such as form creation, object configuration, routing, authentication, templating, and many others. You can install any of the Components with the Composer PHP dependency manager. The website of Symfony has a cool showcase section where you can take a peek at the projects developers accomplished with the help of this handy framework.
Symfony

3. CodeIgniter

CodeIgniter is a lightweight PHP framework that is almost 10 years old (initially released in 2006). CodeIgniter has a very straightforward installation process that requires only a minimal configuration, so it can save you a lot of hassle. It’s also an ideal choice if you want to avoid PHP version conflict, as it works nicely on almost all shared and dedicated hosting platforms (currently requires only PHP 5.2.4).
CodeIgniter is not strictly based on the MVC development pattern. Using Controller classes is a must, but Models and Views are optional, and you can use your own coding and naming conventions, evidence that CodeIgniter gives great freedom to developers. If you download it, you’ll see it’s only about 2MB, so it’s a lean framework, but it allows you to add third-party plugins if you need more complicated functionalities.
CodeIgniter

4. Yii 2

If you choose the Yii framework you give a boost to the performance of your site as it’s faster than other PHP frameworks, because it extensively uses the lazy loading technique. Yii 2 is purely object-oriented, and it’s based on theDRY (Don’t Repeat Yourself) coding concept, so it provides you with a pretty clean and logical code base.
Yii 2 is integrated with jQuery, and it comes with a set of AJAX-enabled features, and it implements an easy-to-use skinning and theming mechanism, so it can be a great choice for someone who comes from a frontend background. It has also a powerful class code generator called Gii that facilitates object-oriented programming and rapid prototyping, and provides a web-based interface that allows you to interactively generate the code you need.
Yii

5. Phalcon

The Phalcon framework was released in 2012, and it quickly gained popularity among PHP developers. Phalcon is said to be fast as a falcon, because it waswritten in C and C++ to reach the highest level of performance optimization possible. Good news is that you don’t have to learn the C language, as the functionality is exposed as PHP classes that are ready to use for any application.
As Phalcon is delivered as a C-extension, its architecture is optimized at low levels which significantly reduces the overhead typical of MVC-based apps. Phalcon not only boosts execution speeds, but also decreases resource usage. Phalcon is also packed with many cool features such as a universal auto-loader, asset management, security, translation, caching, and many others. As it’s awell-documented and easy-to-use framework, it’s definitely worth a try.
Phalcon

6. CakePHP

CakePHP is already a decade old (the first version was released in 2005), but it’s still among the most popular PHP frameworks, as it has always managed to keep up with time. The latest version, CakePHP 3.0 enhanced session management,improved modularity by decoupling several components, and increased the ability of creating more standalone libraries.
CakePHP has a really remarkable showcase, it powers the websites of big brands such as BMWHyundai, and Express. It is an excellent tool for creating web apps that need high-level of security, as it has many built-in security features such as input validation, SQL injection prevention, XSS (cross-site scripting) prevention, CSRF (cross-site request forgery) protection, and many others.
CakePHP

7. Zend Framework

Zend is a robust and stable PHP framework packed with a lot of configuration options therefore it’s usually not recommended for smaller projects butexcellent for more complex ones. Zend has partners such as IBM, Microsoft, Google and Adobe. The coming major release, Zend Framework 3 will beoptimized for PHP 7 , but will still support PHP 5.5 onwards.
The current release, Zend Framework 2 also has many cool features such as cryptographic coding tools, an easy-to-use drag and drop editor with support for front-end technologies (HTML, CSS, JavaScript), instant online debugging and PHP Unit testing tools, and a connected Database Wizard. Zend Framework was created with the Agile methodology that facilitates delivering high-quality apps to enterprise clients.
Zend Framework

8. Slim

Slim is a PHP micro framework that provides you with everything you need and nothing you don’t. Micro frameworks are minimalistic in design, they areexcellent for smaller apps where a full-stack framework would be an exaggeration. Slim’s creator was inspired by a Ruby micro framework calledSinatra.
Slim is used by many PHP developers for developing RESTful APIs and services. Slim comes with features such as URL routing, client-side HTTP caching, session- and cookie encryption, and it supports “flash” messages across HTTP requests as well. Its User Guide is an easy read, and if you are interested in the new features of the upcoming major release (already in beta), you can watch this primer video about Slim 3.
Slim

9. FuelPHP

FuelPHP is a flexible full-stack PHP framework that doesn’t only support the ordinary MVC pattern but also its evolved version, HMVC (Hierarchical Model-View-Controller) at the architecture level. FuelPHP adds an optional classcalled Presenter (formerly called ViewModel) between the Controller and View layers to hold the logic needed to generate Views.
FuelPHP is modular and extendable, takes care of security concerns by providing features such as input and URI filtering and output encoding, and it comes with its own authentication framework, with many other sophisticatedfeatures and a detailed documentation.
FuelPHP

10. PHPixie

PHPixie is a quite new framework, it started in 2012 with the goal of creating a high-performance framework for read-only websites. PHPixie also implements the HMVC design pattern just like FuelPHP, and is built by using independentcomponents that can be used as well without the framework itself. The PHPixie components are 100% unit tested, and require minimum dependencies.
The official website has a tutorial that claims you can learn the framework in 30 minutes, and their blog also details many practical use cases. Among the features you can find the standard ORM (object-relational mapping), caching, input validation, authentication and authorization capabilities. PHPixie also allows you to use the HAML markup language, enables schema migration, and has a sophisticated routing system.
PHPixie

10 Programming Languages You Should Learn Right Now

The tech sector is booming. If you've used a smartphone or logged on to a computer at least once in the last few years, you've probably noticed this.
As a result, coding skills are in high demand, with programming jobs paying significantly more than the average position. Even beyond the tech world, an understanding of at least one programming language makes an impressive addition to any resumé.
The in-vogue languages vary by employment sector. Financial and enterprise systems need to perform complicated functions and remain highly organized, requiring languages like Java and C#. Media- and design-related webpages and software will require dynamic, versatile and functional languages with minimal code, such as Ruby, PHP, JavaScript and Objective-C.
With some help from Lynda.com, we've compiled a list of 10 of the most sought-after programming languages to get you up to speed.

1. Java

Java

IMAGE: MASHABLE COMPOSITE. IMAGE: WIKIMEDIA COMMONS
What it is: Java is a class-based, object-oriented programming language developed by Sun Microsystems in the 1990s. It's one of the most in-demand programming languages, a standard for enterprise software, web-based content, games and mobile apps, as well as the Androidoperating system. Java is designed to work across multiple software platforms, meaning a program written on Mac OS X, for example, could also run on Windows.
Where to learn it: UdemyLynda.comOracle.comLearnJavaOnline.org.

2. C Language

C Language

IMAGE: MASHABLE COMPOSITE. IMAGE: WIKIMEDIA COMMONS
What it is: A general-purpose, imperative programming language developed in the early '70s, C is the oldest and most widely used language, providing the building blocks for other popular languages, such as C#, Java, JavaScript and Python. C is mostly used for implementing operating systems and embedded applications.
Because it provides the foundation for many other languages, it is advisable to learn C (and C++) before moving on to others.

3. C++

C Plus Plus

IMAGE: MASHABLE COMPOSITE. IMAGE: WIKIMEDIA COMMONS
What it is: C++ is an intermediate-level language with object-oriented programming features, originally designed to enhance the C language. C++ powers major software like FirefoxWinampand Adobe programs. It's used to develop systems software, application software, high-performance server and client applications and video games.

4. C#

C Sharp

IMAGE: MASHABLE COMPOSITE. IMAGE: WIKIMEDIA COMMONS
What it is: Pronounced "C-sharp," C# is a multi-paradigm language developed by Microsoft as part of its .NET initiative. Combining principles from C and C++, C# is a general-purpose language used to develop software for Microsoft and Windows platforms.

5. Objective-C

Objective-C

IMAGE: MASHABLE COMPOSITE. IMAGE: WIKIMEDIA COMMONS
What it is: Objective-C is a general-purpose, object-oriented programming language used by theApple operating system. It powers Apple's OS X and iOS, as well as its APIs, and can be used to create iPhone apps, which has generated a huge demand for this once-outmoded programming language.

6. PHP

PHP

IMAGE: MASHABLE COMPOSITE. IMAGE: WIKIMEDIA COMMONS
What it is: PHP (Hypertext Processor) is a free, server-side scripting language designed for dynamic websites and app development. It can be directly embedded into an HTML source document rather than an external file, which has made it a popular programming language for web developers. PHP powers more than 200 million websites, including WordpressDigg andFacebook.

7. Python

Python

IMAGE: MASHABLE COMPOSITE. IMAGE: WIKIMEDIA COMMONS
What it is: Python is a high-level, server-side scripting language for websites and mobile apps. It's considered a fairly easy language for beginners due to its readability and compact syntax, meaning developers can use fewer lines of code to express a concept than they would in other languages. It powers the web apps for InstagramPinterest and Rdio through its associated web framework, Django, and is used by GoogleYahoo! and NASA.
Where to learn it: UdemyCodecademyLynda.comLearnPython.orgPython.org.

8. Ruby

Ruby

IMAGE: MASHABLE COMPOSITE. IMAGE: WIKIMEDIA COMMONS
What it is: A dynamic, object-oriented scripting language for developing websites and mobile apps, Ruby was designed to be simple and easy to write. It powers the Ruby on Rails (or Rails) framework, which is used on ScribdGitHubGroupon and Shopify. Like Python, Ruby is considered a fairly user-friendly language for beginners.
Where to learn it: CodecademyCode SchoolTryRuby.orgRubyMonk.

9. JavaScript

JavaScript

IMAGE: MASHABLE COMPOSITE. IMAGE: WIKIMEDIA COMMONS
What it is: JavaScript is a client and server-side scripting language developed by Netscape that derives much of its syntax from C. It can be used across multiple web browsers and is considered essential for developing interactive or animated web functions. It is also used in game development and writing desktop applications. JavaScript interpreters are embedded in Google's Chrome extensions, Apple's Safari extensions, Adobe Acrobat and Reader, and Adobe's Creative Suite.
Where to learn it: CodecademyLynda.comCode SchoolTreehouseLearn-JS.org.

10. SQL

SQL

What it is: Structured Query Language (SQL) is a special-purpose language for managing data in relational database management systems. It is most commonly used for its "Query" function, which searches informational databases. SQL was standardized by the American National Standards Institute (ANSI) and the International Organization for Standardization (ISO) in the 1980s.

Monday, January 4, 2016

Best Practices for Developing Web Apps

Introduction

Whether you are porting an existing web app or creating a new web app for Fire tablets or Android devices, it's important to consider how different device capabilities affect the behavior or appearance of your app. Use the following best practices and guidelines to optimize your web app.

Protecting Your Web App

Communication on the Internet is susceptible to eavesdropping and malicious tampering. Amazon Mobile App Distribution recommends you take action to protect the web apps you submit. The best thing you can do to secure your web apps is to use SSL (Secure Sockets Layer, i.e. HTTPS).

Plan for Changes in Device Orientation
Your customers may use your app with the device oriented in either portrait or landscape mode. Use these tips for managing your app's behavior in different orientations.

Use Responsive Design Techniques

The spectrum of screen sizes and resolutions is widening every day. For this reason, creating a different version of a web app that targets each individual device is not a practical way forward. Instead, use responsive web design techniques to provide an optimal viewing experience, with a minimum of resizing, panning, and scrolling across a wide range of devices.

Lock Orientation in Portrait or Landscape Mode

Native apps such as games are often designed to run in only one optimal orientation. When a customer rotates the device, the app stays locked in its original orientation.
The Web App Resources provide sample code that locks the orientation of an app. This code is located in the folder <install location>/Web/samples/webapp-cookbook/ForceOrientation/

Instruct Customers to Rotate the Device 

If your app runs best in one orientation, tell customers with words or pictures to rotate their device to that orientation.


Turn Off Touch Feedback

By default, most Android devices provide visual feedback to customers when they tap web links. This feedback usually appears as a translucent block of color overlaying the target of the link. If you want to disable this behavior, include the following code in your CSS markup.
 
          body { 
          -webkit-tap-highlight-color: rbga(255, 255, 255, 0); 
          -webkit-user-select: none; 
          }

Make Sure Your Web App Fills the Screen

Design your app to fill the entire screen taking into consideration that devices have different screen sizes and aspect ratios. In certain cases it may not be possible for your app to fill the entire screen e.g. the app may need to be letterboxed or the native aspect ratio may not match that of the target device. In these scenarios the app must fill 80% of the screen. The Web App Resources include sample code that dynamically resizes an app for any device while maintaining the proper aspect ratio. This code is located in the folder <install location>/Web/samples/webapp-cookbook/FillScreen/

If you use the tag to provide custom settings for your viewport, you may notice a difference in your web app rendering on Fire tablets and non-Amazon Android devices.
If you have content wider than the screen, the viewport may zoom out to fit the content. To prevent this, add the following to the head section:
<meta name="viewport" content="user-scalable=no">

User Agent Strings

Get information on specific user agent strings.

Best Practices for Game Apps

    • Use requestAnimationFrame to cap the frame rate. Do not render at more than required rate.
    • Use data structures to keep track of game state.
    • Use efficient collision detection algorithms and data structures such as k-d tree, quad tree, r-tree, bounding rectangles etc. or use an efficient pre-existing library. An example of an efficient collision detection technique can be seen here.
    • Do not constantly calculate game states dynamically.
    • Do not try to draw things that are not visible.
    • Do not use CSS box-shadows as they are expensive to paint and can significantly degrade performance.

    Best Practices for Using <canvas> Element

    • Use sprites with pre-generated content in the form of textures.
    • Use integer coordinates to avoid sub-pixel math.
    • Use an off-screen canvas for drawing calls like line, stroke, path etc. and copy the resulting buffer to the main render canvas.
    • Use web workers to draw on the off-screen canvas in a separate worker thread.
    • When using canvas draw calls, batch them together for better performance.
    • Keep unchanging backgrounds and animated objects in different rendering layers. This reduces the rendering overhead due to static content.
    • Use clearRect to clear the canvas instead of alternatives such as resetting the width or height attribute.
    • Minimize state changes to the canvas.
    • Track and reduce the portions of the animating canvas that require re-rendered if the engine does not detect and optimize a non-preserve mode.
    • Avoid blurring. This can be expensive.
    • Avoid pixel readbacks and manipulations because they will disable any parallelization/pipelining that the rendering engine might otherwise be able to do.

    Best Practices to Optimize Compositing Layers for Web Apps

    Amazon Web View improves rendering by sending select layers to the GPU to be composited. If a CSS transform is carried out on a div that is part of the root layer, a layer is created on the fly and sent to the GPU to be composited. This gets expensive for larger, more complex divs. To improve performance, divs that will be transformed/repainted frequently should be made into their own compositing layers in advance.
    A RenderLayer gets its own compositing layer if one of the following is true:
    • Layer has 3D or perspective transform CSS properties.
    • Layer is used by <video> element using accelerated video decoding.
    • Layer is used by a <canvas> element with a 3D context or accelerated 2D context.
    • Layer is used for a composited plugin.
    • Layer uses a CSS animation for its opacity or uses an animated webkit transform.
    • Layer uses accelerated CSS filters.
    • Layer with a composited descendant has information that needs to be in the composited layer tree, such as a clip or reflection.
    • Layer has a sibling with a lower z-index that has a compositing layer.

    Best Practices for JavaScript

    • Use Typed Arrays where possible instead of JS Arrays.
    • Use "for" loops instead of "for-in" loops. "for" loops are more efficient.
    • Use local variables as much as possible. However if a variable is a complex object and needs allocation support, you may want to create it as singleton (provided its data-type does not change and the object does not become polymorphic).
    • Do not create "large" methods. Modularize and break methods into smaller algorithmic chunks. The Virtual Machine can inline and recreate larger methods where it deems profitable. The reverse is not true.
    • Do not use variables where the data-type could change, such as between int to float to double.

        Preserve Navigation within your App

        Your customers will have the best experience using your app if the navigation flow stays within the app and does not launch the customer into a browser on the device. Test the core app functionality and ensure that the customer does not get launched into a browser.