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.

  • 64 exercises
  • 55 new features

64 exercises · 41 to 60

Sort: Recent Title

By title

20
  1. 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
  2. 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
  3. Symfony 8.2 New One import at a time, with #[Lock] #[Lock] puts a lock on a controller: a concurrent request gets a 409, and reads can share a lock between them. HttpKernelLock Do the exercise
  4. 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
  5. Symfony Paginating orders loaded with their items On a query with a join, setMaxResults() limits SQL rows, not entities: Doctrine's Paginator pages through orders without cutting their collections. DoctrineRelationsPaginationN+1 queries Do the exercise
  6. Symfony 8.2 New Pay, ship, and cancel if it breaks ChainStamp chains messages in order, and DispatchOnFailureStamp sends the cancellation whichever step fails: a saga in a single dispatch(). Messenger Do the exercise
  7. Symfony Protecting a delete action with a CSRF token A "Remove" link sent as a GET deletes the dish for the first bot that comes along: switch to POST, with a CSRF token for each dish. SecurityCSRFTwig 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.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
  10. 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
  11. 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
  12. Symfony 8.2 New Require an SMS code before a transfer AuthenticationMethodBadge and getAuthenticationProofs(): the token remembers how the user authenticated, and a voter can require a second factor. Security Do the exercise
  13. 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
  14. 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
  15. Symfony Saving an order with its items “A new entity was found through the relationship”: with cascade: ['persist'], a single persist() saves the order and its items. DoctrineRelationsOneToMany Do the exercise
  16. Laravel 13.35 New Searching with a request body thanks to the QUERY method Route::query() declares a route for the HTTP QUERY method: a read, like GET, but with its criteria in the request body. RoutingHTTP Do the exercise
  17. Laravel 13.38 New See what you just wrote right away, despite the replica The PreventStaleDatabaseReads middleware sends a visitor's reads to the primary database right after they wrote, and DB::usingWritePdo() does it for a block of code. DatabaseMiddleware Do the exercise
  18. Laravel 13.35 New Serving a page as Markdown with response()->markdown() response()->markdown() returns Markdown with the right content type, text/markdown, for the readers and agents that ask for it. ResponsesHTTP Do the exercise
  19. Symfony Setting the style of EasyAdmin badges EasyAdmin badges separate the color (color) from the style (variant); since 5.8, the style is set at once for the whole back office or for a single CRUD controller. EasyAdminTwig Do the exercise
  20. Laravel 13.35 New Stop a long command cleanly with schedule:interrupt schedule:interrupt timestamps its signal, and hasBeenInterruptedSince() reads it: a long command stops between two batches, without cutting the current one. ConsoleScheduling Do the exercise