Practice

Use a feature, right now

Short exercises, separate from the tracks: code written the old way, to rewrite with the feature. Often something new in the framework, sometimes a specific point worth a closer look.

  • 20 exercises
  • 20 new features

20 exercises

Sort: Recent Title

This week

6
  1. Laravel 13.34 New Counting the rows of several tables in one assertion assertDatabaseCount() accepts an array: the expected number of rows in each table, checked in a single assertion. TestingDatabase Do the exercise
  2. Symfony 8.2 New One name per API version, and groups to leave out #[SerializedName('name', groups: 'v1')]: a property changes name depending on the group; ignored_groups leaves a group out without touching the class. SerializerAPI Do the exercise
  3. Laravel 13.33 New Reading back the columns the database computes with #[Refreshes] A model marked #[Refreshes] reads back, after every write, the columns the database fills in itself: default value, generated column. Eloquent Do the exercise
  4. Symfony 8.2 New One Cache-Control for the CDN, another for the browser $response->cacheControl('CDN') writes a CDN-Cache-Control header: the CDN, which you can purge, keeps the page for a long time; the browser doesn't. HttpFoundationHTTP cache Do the exercise
  5. Laravel 13.32 New Moving a file from one disk to another with moveToDisk() copyToDisk() and moveToDisk() stream a file from one disk to another, without loading it into memory. Storage Do the exercise
  6. Symfony 8.2 New A reset link that only works once UriSigner::sign() accepts a “version”: sign the link with the password hash, and it dies as soon as the password changes. HttpFoundationSecurity Do the exercise

Earlier

14
  1. Symfony 8.2 New Listeners that position themselves relative to each other #[AsEventListener(after: …, before: …)]: the order of listeners is stated by their names, no longer by guessed priorities. EventDispatcher Do the exercise
  2. Symfony 8.2 New Roles by family, with wildcards ROLE_BLOG_*: a single role_hierarchy key covers a whole family of roles, including those declared nowhere. SecurityRoles Do the exercise
  3. Laravel 13.26 New Handling only the last event of a burst with #[DebounceFor] A queued listener with #[DebounceFor] waits for the burst to end and handles only the last event, where ShouldBeUnique kept the first one. QueuesEvents Do the exercise
  4. Laravel 13.26 New Migrating files as they are read with read-through A read-through disk reads the new storage, falls back to the old one and copies over what it finds there: the migration happens by itself. Storage Do the exercise
  5. Laravel 13.31 New Checking that an email is sent only once assertSentOnce() and assertSentOnDemandOnce(): the Mail and Notification fakes finally say “exactly once” in one word. TestingMailNotifications Do the exercise
  6. Symfony 8.2 New One field for a date range, with BoundsType Two dates and the rule that orders them fit in a single field: no more POST_SUBMIT listener comparing the bounds by hand. Forms Do the exercise
  7. Laravel 13.24 New Restricting an array's keys with array_keys A validation rule for “this array only contains these keys”: no more closure comparing array_keys() to a list. Validation Do the exercise
  8. Symfony 8.2 New Readable subscribers: method and priority ['trace', 100] becomes ['method' => 'trace', 'priority' => 100]: getSubscribedEvents() finally says what each slot holds. EventDispatcher Do the exercise
  9. Symfony 8.2 New Describing a form with attributes A form's fields are declared on the DTO, right next to the validation constraints: no more form class for simple cases. FormsDTO Do the exercise
  10. Symfony 8.2 New Let a ValidationFailedException bubble up An uncaught ValidationFailedException now gives a 422 with the list of violations: no more need to wrap it. ValidatorAPI Do the exercise
  11. Symfony 8.2 New Reading a whole collection with [*] A path like [*][members][*][email] replaces nested loops: PropertyAccess reads every element of a collection. PropertyAccess Do the exercise
  12. Laravel 13.30 New Grouping adjacent items with chunkBy() Consecutive messages from the same author are grouped into one line, without a loop or a tracking variable. Collections Do the exercise
  13. Symfony 8.1 New Reading a header with #[MapRequestHeader] An HTTP header arrives directly as a controller argument, and a missing header gives a 400 without a line of code. ControllerHttpKernel Do the exercise
  14. Symfony 8.2 New Docker-style sub-commands tenant --name=acme users list: the group carries the option once, each sub-command reads it from the command chain. Console Do the exercise