Portada: RSS reading app with Laravel 5

A few weeks ago, along with Pablo Massa, we launched Portada, a web app to read news from multiple sources.

The Problem

The problem we were trying to solve is that local news sites are mostly hard to read, hard to skim through and cluttered with ads. Also, it would be cool to have all news sources in a timeline fashion. Although you could certainly achieve this last feature using a regular feed reader.

Our Solution

So after a few iterations and proof of concepts, we put together a few components that make the whole app: a Laravel 5 backend for administering news and news sources, a spider that crawls news sources every 5 minutes and dumps them into our database, and a beautifully readable front-end.

Some specs

Apart from Laravel 5, we’re using:

  • Bower for managing dependencies in the front-end.
  • Laravel Envoy for deploying.
  • Bootstrap 3 for the backend.
  • Fastfeed for parsing RSSs.
  • Mustache.js for templating on the front-end.
  • Less/Lesshat for our styles.

From here

The app is mainly done, although we keep a Trello board full of features to evaluate and implement. Some of them include some e-mailing, basic search, real-time refresh, automated testing and of course some refactoring.

You can check out the posts in our blog (in spanish) to follow up the development and design of the app, or read the source code in GitHub.

Set friendly names for validation attributes in Laravel 4

I just lost half an hour on this, so I figured I’d help you save some precious time.

Every search on Google returned info on how to specify custom messages, which is nicely documented, but there’s currently nothing about friendly names on attributes on the docs.

After searching on Google, roaming through Laravel’s code and trying almost everything, I got to this comment on GitHub.

You may call setAttributeNames on a Validator instance now.

So, for example’s sake:

$rules = array(
    ‘username’ => ‘required|min:8|unique:users|integer’,
    ‘firstname’ => ‘required’,
    ‘lastname’ => ‘required’,
    ‘email’ => ‘required|email’,
    ‘password’ => ‘required|confirmed’
);

$messages = array(
    ‘required’ => ‘El campo :attribute es obligatorio.’,
    ‘email.required’ => ‘El campo de :attribute es requerido y debe ser una dirección válida.’,
    ‘validation.confirmed’ => ‘Las contraseñas no coinciden.’
);

$friendly_names = array(
    ‘firstname’ => ‘Nombre’,
    ‘lastname’ => ‘Apellido’
);

$validator = Validator::make(Input::all(), $rules, $messages);
$validator->setAttributeNames($friendly_names);