The Acumen blog provides you with information on Moodle.

Moodle is a free, open source learning management platform where educators of any kind can create a private space on the web. When using Moodle, the user can access tools that allow them to easily create collaborative courses and activities geared toward synergistic learning.

These websites provide a good overview.

Official Moodle Overview

Moodle Wikipedia

PHP is a powerful and one of the most popular coding language among web programmers. Majority of the most popular websites on the web are based on PHP programming language. In this article, we are looking to help you choose the best PHP framework for 2014.

Every developer knows that a proper framework enables to create applications quicker, safer and more efficiently. Choosing a right framework before building your application is crucial for robustness and success. PHP frameworks are super useful tools for web development, as they are real time-savers when it comes to creation and maintenance of the PHP website.

Generally framework consists of:

  • A Toolbox – a set of prefabricated, rapidly integrated software components.
    It means writing less code, with less risk of error. It also means greater productivity and the ability to devote more time to doing those things which provide greater added value, such as managing guiding principles, side effects, etc.
  • A Methodology – an “assembly diagram” for applications. A structured approach may seem constraining at first. But in reality it allows developers to work both efficiently and effectively on the most complex aspects of a task, and the use of Best Practices guarantees the stability, maintainability and upgradeability of the applications you develop.

There are a lot of solid PHP frameworks on the market, so it is probably hard to choose one. We have gathered a list of the best PHP frameworks currently on the market and share our insights in finding the best one for your application. Every framework has its own advantages as well as disadvantages, so if you have a preferred Framework by which you work with aside from the ones listed here, please do let us know by dropping us your feedback in the comment section below.

1. Laravel : The PHP Framework for Web Artisans

Laravel - Best PHP Framework 2014

Laravel is a free, open source PHP Web application framework, designed for developing MVC web applications. In our opinion, Laravel is the best overall PHP framework of 2014. I personally believe that Laravel has taken PHP frameworks to the whole new level. Laravel helps you create wonderful applications using simple, expressive syntax, aiming to take the pain out of web development by easing common tasks, such as authentication, routing, sessions and caching. Laravel is well readable and well-documented that helps you speed up your coding. Laravel makes development easy and more creative for developers and lets them produce some outstanding result with it. With Composer you can manage all your application’s third-party packages, and works great on MySQL, Postgres, SQL Server, and SQLite.

Laravel uses the solid, tested components of the Symfony framework along with other popular packages to provide a modern framework that provides easy conventions, utilizes modern programming patterns and makes development a breeze.

Laravel has changed my life. The best framework to quickly turn an idea into product.

Maksim Surguy

Laravel reignited my passion for code, reinforced my understanding of MVC, and made development fun again!

Jozef Maxted

Laravel kept me from leaving PHP.

Michael Hasselbring

2. Phalcon

Phalcon the Fastest PHP Framework 2014

Phalcon is the fastest framework on the list. Built on C, but offered as PHP extension, it offers no compromise speed wise. It offers high performance and lower resource usage. There’s no need to learn or use the C Language, as the functionality is exposed as PHP classes ready to use. By creating a rich, fully featured framework written entirely in C and packaged as a PHP extension, Phalcon is able to save processor time and boost overall performance.

In the past, performance was not considered one of the top priorities when developing web applications. Reasonable hardware was able to compensate for that. However when Google  to take site speed into account in the search rankings, performance became one of the top priorities alongside functionality. This is yet another way in which improving web performance will have a positive impact on a website.

3. Symfony 2

Symfony2 PHP Framework

Symfony is a PHP framework for web projects. It speed up the creation and maintenance of your PHP web applications. Replace the repetitive coding tasks by power, control and pleasure.

Symfony is a set of reusable PHP components and a PHP framework for web projects. It is well documented, it is free under MIT license, and it is getting more and more popular every day. Drupal, one of the most popular CMS systems, as well as phpBB, one of the most used discussion board system, use symfony.

The is powerful, scalable and flexible. Yet it is considered by many, especially those new to frameworks, to have a very steep learning curve.

This is true to a certain extent. At first glance, Models, Views, Controllers, Entities, Repositories, Routing, Templating, etc, altogether can appear very terrifying and confusing.

However, if you have grasped the fundamentals of PHP and HTML, have a basic understanding of modern web site development (in particular, Pretty URIs, MVC), and know how to CRUD a database/table, you are not far from developing a fairly good website, be it for your personal usage or business application.

4. Yii Framework

Yii PHP Framework

Yii is the fast, secure and professional PHP Framework. It is a high-performance PHP framework best for developing Web 2.0 applications. Yii Comes with rich features: MVC, DAO/ActiveRecord, I18N, caching, authentication and role-based access control, scaffolding, testing, open source, high performing, object oriented, database access object, easy form validation, default support for web services and many more. Yii Framework is ideal and perfect for developing social networking websites reduces development time significantly.

Yii Framework is a good choice for developing new high quality web-applications in rapid time. The well designed foundation with excellent documentation helped us developing Chives remarkable user experience and functionality in very short time.

David Roth

Yii Framework met all our needs! It worked equally good for both rapid prototyping and large scale web applications. It allowed us to focus on our unique idea while still offering the flexibility to bend our application in all directions we want.

Knut Urdalen

Yii is a simple but very powerful application framework with a very short learning curve. Its component-based design allows us to customize it for our needs without directly modifying it — maintaining upgradability. It’s amazing how we were able to use it not just on our main app and our API, but also on our daemons!

Blue Jayson

 

5. CodeIgniter

CodeIgniter PHP Framework

CodeIgniter is a proven, agile and open PHP web application framework with a small footprint. It is powering the next generation of web applications.

CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you’re a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you’re tired of ponderously large and thoroughly undocumented frameworks, then CodeIgniter might be a good fit.

CodeIgniter is right for you if:

  • You want a framework with a small footprint.
  • You need exceptional performance.
  • You need clear, thorough documentation.
  • You are not interested in large-scale monolithic libraries.
  • You need broad compatibility with standard hosting.
  • You prefer nearly zero configuration.
  • You don’t want to adhere to restrictive coding rules.
  • You don’t want to learn another template language.
  • You prefer simple solutions to complexity.
  • You want to spend more time away from the computer.

6. Cake PHP

Cake PHP Framework

CakePHP is one of the frameworks to follow in 2014. They are about to release a stable version 3.0 to the public. CakePHP makes building web applications easier, faster, and requires less code. It enabled to use code generation and scaffolding features to rapidly build prototypes. No additional XML or YAML file configuration is required, just setup your database and you are ready to bake. CakePHP is licensed under the MIT license which makes it perfect for use in common applications. The things you need are built-in: translations, database access, caching, validation, authentication, and much more are all built into one of the original PHP MVC frameworks. CakePHP comes with built-in tools for input validation, CSRF protection, Form tampering protection, SQL injection prevention and XSS prevention, helping you keep your application safe and secure.

7. Zend Framework

Zend PHP Framework

I’ve used Zend Framework 1 and 2 in large scale enterprise projects for years. It has been one of the leading PHP frameworks with flexible architecture suitable for modern web applications for years. Recently I have switched over to a couple of newborn frameworks, but that is my personal preference.

Zend framework is designed with simplicity in mind. It is lightweight, easily customizable, and focused on most common needed functionality. It is built to dramatically ease the learning curve you must climb when adapting to a new framework. It is widely used, so quite well tested and safe.

Despite all the advantages, it is has quite different user experiences over the years. Some users call it “extremely complicated, the worst I have known so far”.

Extremely complicated framework, the worst that I have known so far (I have worked with symfony, Yii and django; all them are easier to learn)

Great framework with a great community and a lot of tutorials…nearly everything is good, just the speed could be better.

ZF is overly complicated. At some point you will find yourself struggling with it just to make things done. Syntax is too lengthy.
I’d say ZF is a great PHP class library but an awful web framework.

8. Kohana

Kohana PHP Framework

Kohana is an elegant PHP framework with a rich set of features for building web applications. It allows to build web applications quickly, as it has many common components included, as translation tools, database access, code profiling, encryption, validation, and more. It also has good debugging and profiling tools which helps to solve any occurring problems, which often is very time-consuming without the right tools.

Kohana is built to be a very fast PHP framework, carefully optimized for real world usage. However, some of the tests shown that it is slower than CodeIgniter, and some other major players on the list. But in general, it scores very well on benchmarks.

This is an OOP framework that is very dry. Everything is build using strict PHP 5 classes and objects. This shows that Kohana is sticking to the very best of PHP new features and is closely optimizing its core code.

9. Fuel PHP

Fuel PHP Framework

Fuel is a simple, flexible, community driven PHP 5.3+ framework, based on the best ideas of other frameworks. It is currently releasing version 2 of the project, currently in beta stage.

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 ViewModels (also known as presentation models) 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 uri, making the closure the controller and giving it control of further execution.

10. Silex

Silex PHP Framework

Silex is the PHP micro-framework based on the Symfony2 Components.

Silex is a PHP micro-framework for PHP 5.3. It is built on the shoulders of Symfony2 and Pimple and also inspired by sinatra.

A microframework provides the guts for building simple single-file apps. Silex aims to be:

Concise: Silex exposes an intuitive and concise API that is fun to use.
Extensible: Silex has an extension system based around the Pimple micro service-container that makes it even easier to tie in third-party libraries.
Testable: Silex uses Symfony2’s HttpKernel which abstracts request and response. This makes it very easy to test apps and the framework itself. It also respects the HTTP specification and encourages its proper use.

Performance benchmark of the best PHP frameworks

There are many assumptions around performance of different PHP frameworks. I frequently hear strong opinions about superiority X over Y in this context. There are companies writing new PHP frameworks from scratch because available solutions are too slow for them. Let’s see what the number are telling.

Performing a representative benchmark across different framework is not an easy task. There are multiple ways to use each of them. Every use case will give different reading. Lets take routing as an example. Zend Framework 1 by default doesn’t need a routing file. It’s happy to use “/controller/action” pattern. On the other hand Symfony2 comes with a routing configuration. The file has to be read and parsed. That obviously takes some additional CPU cycles but does it mean Symfony2 routing is slower then Zend Framework 1? The answer is (obviously) no.

Systemarchitect has benchmarked “quick start” projects. That gives some idea on what is the base line for every framework and makes it possible to reproduce my tests (and argue against them).
Code was hosted on Amazon EC2 medium instance. I installed PHP-APC to avoid disk access and code parsing. I also made sure there is no I/O on Apache2 or application level. I set logs and cache paths to “/dev/shm/”. I tweaked projects to make them return roughly the same amount of data (10KB). All virtual hosts had the same mod_rewrite rules. AllowOveride was set to None.

Requests per second from Apache Benchmark with c=20 and n=500.

FrameworkReq/Sec
Phalcon822.96
Slim399.83
Kohana217.34
Code Igniter187.78
Silex179.01
Laravel135.9
YII123.5
Fuel PHP116.34
Hazaar MVC103.53
Zend Framework 1103.02
Cake PHP54.97
Nette53.48
Symfony239.22
Zend Framework 236.1

PHP Framework Benchmark 2014

Based on Systemarchitect’s benchmark, I’m not surprised, Phalcon is beating everyone on the list, as well as seeing Slim to be the second fastest because it’s a micro framework. The Quick Start project didn’t use any templates or layout which obviously contributed to the reading. Zend Framework 1 is twice faster than Symfony2 and Zend Framework 2 but in my experience the number will quickly go down in a real live setup.

Frameworks should speed up development, performance is a secondary concern. Zend Framework 2 and Symfony2 could do better but it’s not bad. There are ways to improve those numbers on production servers. Don’t reinvent the wheel, learn and use frameworks. There are various options which balance between performance and features.

Acumen’s summary

Summarizing the list, we think that the best 5 PHP Frameworks currently are: Laravel, Phalcon, Symfony2, CodeIgniter and Yii.

The same is shown by the recent study at Sitepoint, showing Laravel having over 25% of the popularity votes, Phalcon almost 17%, Symfony2 over 10%, CodeIgniter and Yii having 7.62%. PHP Framework Market Share 2014

But we understand that a PHP framework is more of a preference for the web developer and that in the market today there are many strong products.

MVC Entity Framework error / EF Error

EF Error

 

 

Problem

From a page in IIS or a debug session in Visual Studio, you receive the following error:

The associated metadata type for type contains the following unknown properties or fields:

Please make sure that the names of these members match the names of the properties on the main type

Root Cause

The MetadataGenerator.cs file has references to out-of-date relationships.

Solution

Rebuild or edit the MetadataGenerator.cs file.  Since MetadataGenerator.cs is an autogenerated file.

Be careful that you don’t lose custom DataAnnotations that you have made for UI and client-side error handling.

For more information about Acumen Software Design, contact us today!

To learn more about Visual Studio, click on the link below:

https://visualstudio.microsoft.com/team-services/

.net MVC

.net mvc

Our .net MVC development team started working with the new Web API 2 controllers released with Visual Studio 2013, and quickly hit some important issues.

Routing and AttributeRouting and using Web API 2 controllers inside an Area in an ASP.NET MVC5 project

Currently, this IS possible. It was not possible with Web API and it seems like it was also not possible in beta, but this can be done with Web API 2 and MVC 5. I used the following configurations:

 // File: ~/Areas/API/APIAreaRegistration.cs
    using System.Web.Http;
    using System.Web.Mvc;

    namespace MySolution.Areas.API {
        public class APIAreaRegistration : AreaRegistration {
            public override string AreaName {
                get {
                    return "API";
                }
            }

            public override void RegisterArea(AreaRegistrationContext context) {
                context.Routes.MapMvcAttributeRoutes();
                context.Routes.MapHttpRoute(
                    name: this.AreaName,
                    routeTemplate: this.AreaName + "/{controller}/{id}",
                    defaults: new { id = RouteParameter.Optional }
                );
            }
        }
    }
 // File: ~/Global.asax.cs
    using System.Linq;
    using System.Web.Http;
    using System.Web.Mvc;
    using System.Web.Routing;
    using Newtonsoft.Json.Serialization;
    using WebMatrix.WebData;
    using AcumenSystem5.Models;
    using System.Threading;
    using System.Web.Optimization;

    namespace MySolution {
        public class MvcApplication : System.Web.HttpApplication {
            protected void Application_Start() {
                AreaRegistration.RegisterAllAreas();
                GlobalConfiguration.Configure(config => { // This HAS to be here. Having it last caused routing to not work.
                    config.MapHttpAttributeRoutes(); // This allows us to use AttributeRouting

                    // This sets JSON as the default return format and removes any circular references
                    var appXmlType = config.Formatters.XmlFormatter.SupportedMediaTypes.FirstOrDefault(t => t.MediaType == "application/xml");
                    config.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType);
                    var json = GlobalConfiguration.Configuration.Formatters.JsonFormatter;
                    json.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
                    config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; 
                });
                RouteConfig.RegisterRoutes(RouteTable.Routes);
                BundleConfig.RegisterBundles(BundleTable.Bundles);
                LazyInitializer.EnsureInitialized(ref _initializer, ref _isInitialized, ref _initializerLock);
            }
        }
    }

AttributeRouting and WebAPI Routing not working correctly and returning 404 Errors – .net MVC

After struggling with areas, I hit this issue when adding the Web API 2 controller to the root controllers folder. I discovered that the ordering of configuration mattered. So, like as shown in the Global.asax.cs above, the order needs to be as follows to work correctly:
protected void Application_Start() {

     // Full file code in example above
        AreaRegistration.RegisterAllAreas();
        GlobalConfiguration.Configure(config => { // This HAS to be here. Having it last caused routing to not work.
            config.MapHttpAttributeRoutes(); // This allows us to use AttributeRouting

            config.Routes.MapHttpRoute( // This allows us to use conventional HTTP routing
                    name: "Name",
                    routeTemplate: "api/{controller}/{id}",
                    defaults: new { id = RouteParameter.Optional }
                ); ;

            // This sets JSON as the default return format and removes any circular references
            var appXmlType = config.Formatters.XmlFormatter.SupportedMediaTypes.FirstOrDefault(t => t.MediaType == "application/xml");
            config.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType);
            var json = GlobalConfiguration.Configuration.Formatters.JsonFormatter;
            json.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
            config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; 
        });
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);
        LazyInitializer.EnsureInitialized(ref _initializer, ref _isInitialized, ref _initializerLock);
    }

Hope this helps!

Check out our ASP.NET MVC to see what we can do for you.

For more information on .net MVC, click on the link below:

https://docs.microsoft.com/en-us/aspnet/mvc/overview/older-versions-1/controllers-and-routing/asp-net-mvc-routing-overview-cs

Recently, while developing an application using Entity Framework, I ran into several compilation errors after adding an additional table to my database. Most notably was this error when trying to declare a couple of variables that had once worked before:

Compiler Error Message: CS1061: … does not contain a definition for … and no extension method … accepting a first argument of type … could be found (are you missing a using directive or an assembly reference?)

When searching around in my .edmx file for reasons as to why my relationships were not working, I ran into this message under the mapping details:

“Mappings are not allowed for an association over exposed foreign keys.”

I wanted to note that this message is not relevant to the issue at hand. After I solved the problem, I still received this message.

I quickly realized that the error had to do with the relationships between tables that I had previously established. When I had added the new table, I deleted the diagram from my .edmx file and updated the model from the database like I normally do when adding a new table. However, this time, Entity Framework did not properly regenerate the code associated with my database. Each property was stored as a class member within the entity class as expected, but my relationships were not. This was despite the fact that my .edmx diagram showed the relationships exactly as they should be.

After hours of Googling different phrases and errors, I ran into this ticket

As it turns out, this is a bug with Entity Framework inside of VS2012, and if your Visual Studio is out of date, you are likely to experience it. Because of this bug, if your .edmx file is nested within a project folder, Entity Framework will sometimes fail to generate code properly. Fortunately, the solution is much easier to implement than it is to find. You can do any of the following:

  • Update your Visual Studios here
  • Right click on the .tt file and select “Run Custom Tool”.
  • Drag the .edmx file out of the project folder.