Microservices with Laravel Lumen

Mathias Hansen
November 18, 2015

Microservices with Laravel Lumen

PHP World 2015

Mathias Hansen

November 18, 2015

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

47 slides
  1. Who I Am » I speak English, Danish, and PHP

    » Have done so for most of my life » Self-proclaimed Laravel evangelist » Started Capital Laravel Group in 2013
  2. What We're Going to Do » Microservices, defined » How

    we're using Microservices at VB » Benefits and drawbacks » Microservices with Lumen » Questions
  3. We have... » A big monolithic app » A growing

    team » Concerns mostly separated » Let's go one step further
  4. Plan ahead » How big should your service be? »

    How many services should you have? » Share common code across services » use composer
  5. Use an API Manager » api.videoblocks.com/search ➡ searchservice.internal » api.videoblocks.com/abtest

    ➡ abtestservice.internal » Authentication » Rate limiting » Usage tracking
  6. A Microservice Hybrid or go all the way? » Monolithic

    app + Micro services » Static Frontend + Micro services » PHP Gateway + Micro services
  7. Teamwork, simplified » Can use any programming language or data

    store under the hood » A small team can own the entire process from dev to deployments » Great for onboarding
  8. Deployments, simplified » Deploy a "piece" of the app instead

    of full monolith » Independent deployment schedule
  9. Testing, simplified » Unit test » Internal functionality » Integration

    test » External interface » Load test » Ability to test each service individually
  10. A microframework » But not necessarily in the traditional sense

    » Based on Laravel components » Follows Laravel versioning » Laravel Lumen 5.1 ➡ Laravel 5.1
  11. It still packs a punch » Blade (templating) » Caching

    » Commands » Controllers » Eloquent ORM » Dependency Injection » Queueing » Testing » And more...
  12. Routing » Uses nikic/FastRoute for routing » You don't need

    a fancy C extension to make routing fast
  13. Opt-in » Core features has to be explictly enabled: »

    dotenv, facades, Eloquent ORM, etc. » Service Providers » Middlewares » CSRF protection, cookie encryption, session handling etc.
  14. What is Lumen not? » Does not support Laravel 5

    packages » Very minimal config system out of the box » Uses environment variables » Can use full config system if you want » Router has fewer features
  15. Conclusion » Define your contract first » Design your microservice

    around a single business capability » Plan ahead » Define testing & deployment strategy » Use Lumen for microservices or other small standalone apps
  16. Additional resources Building Microservices by Sam Newman Martin Fowler's Articles

    http://martinfowler.com/articles/microservices.html Taylor Otwell's Lumen Laracasts https://laracasts.com/lessons/introducing-lumen

More Decks by Mathias Hansen

Other Decks in Technology