Every two weeks I send out a newsletter containing lots of interesting stuff for the modern PHP developer. You can expect quick tips, links to interesting tutorials, opinions and packages. Want to learn the cool stuff? Then sign up now!

Human Readable AJAX Requests

Zach Silveira made a new JavaScript library that aims to make ajax requests much more readable. Under the hood template literals are used.

Anyone familiar with HTTP requests knows what each line in chrome’s network tab means. It’s too bad we can’t copy and paste this into our code and do that exact request….. But we can (almost), if my idea pans out! Take a look at what I’m proposing:

request`  
  url: http://test.app/settings/user/19
  method: PATCH
  headers: ${{ 
    Authorization: 'Bearer: token' 
  }}
  body: ${{ name: 'Bob' }}
`

https://zach.codes/human-readable-ajax-requests/

Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After hours he writes about modern PHP and Laravel on this blog. When not coding he’s probably rehearsing with his kraut rock band. He loves waffles and butterflies.