Community contributed extensions

Play Scala

Welcome to the Play Scala documentation. This documentation is intended for the 0.9.1 release of the Scala module and may significantly differs from previous versions.

Play Scala enables you to use the Scala language for your application keeping key properties of the Play framework. It uses a more functional and Scala idiomatic style of programming without giving up on simplicity and developer friendliness.

This version is still in beta but can already be used to create complete Play applications using Scala as main language. Most of the API is stabilized and future versions will just improve compatibility with the existing Play features.

Check the roadmap to 1.0.

Getting started

Add Scala support to your existing Play installation.

  1. Installing Scala support for Play
  2. ‘Hello World’ tutorial — Your first Play Scala application
  3. Learning Scala with Play

Manual

The Scala version of Play framework share the same philosophy and concepts than the Java version. Here are the Scala specific features deeply explained.

  1. ‘Play Scala’ for Play Java developers
    1. Writing Play controllers in Scala
      1. Scala controllers are Objects
      2. Action methods return values
      3. Return type inference
      4. Controller interceptors
      5. Mixing controllers using Traits
    2. HTTP to Scala data binding
      1. Binding Option types
      2. Using Scala default parameter values
      3. Binding case classes
    3. Database access options
      1. Using Anorm
      2. Integrating other existing Database access librairies
    4. Testing your application
      1. JUnit Style
      2. JUnit Style with Should matchers
      3. Functional suite Style
      4. Specification Style
      5. Features list Style
  2. Scala templates
    1. Overview
    2. Syntax: the magic ‘@’ character
    3. Template paramters
    4. Looping
    5. If-Blocks
    6. Pattern Matching
    7. Declaring reusable blocks
    8. Import statements
    9. Composing templates (tags, layouts, includes, etc.).
  3. Anorm, SQL data access with Play Scala
    1. Overview
    2. Executing SQL requests
    3. Retrieving data using the Stream API
    4. Using Pattern Matching
    5. Dealing with Nullable columns
    6. Using the Parser combinator API
    7. Adding some Magic[T]

Tutorial — Play Scala guide, a real world app step-by-step

Here is the Scala version of the well known ‘Yet Another Blog Engine’ Play tutorial.

  1. Starting up the project
  2. A first iteration of the data model
  3. Building the first screen
  4. The comments page
  5. Setting up a Captcha
  6. (to be continued)