• Skip to main content
  • Skip to primary sidebar

MARTSITE

Martin Hoelzer

  • Home
  • Projects
  • Blog

My Solution to Treehouse Course „Building Websites with PHP“ – Video – „Routing For Our Project“ – with SLIM 3.8

24th Mai 2017 by mpunkth Leave a Comment

Course : Building Websites with PHP

Video : Routing For Our Project

treehouse-image001
Video Screenshot . Treehouse course building-websites-with-php/routing-for-our-project

In the Video SLIM 2.6.2 is used. Todays current Version is 3.8.x.

So I decided to redo it in SLIM 3.8.x while I watched the video.
Source for my redo was the SlimFrameWork Docs

  • https://www.slimframework.com/docs/objects/application.html
  • https://www.slimframework.com/docs/tutorial/first-app.html

My code from the start of this course „Building Websites with PHP“ till the end of the Video „Routing For Our Project“:

[pastacode lang=“php“ manual=“%3C%3Fphp%0A%0A%2F%2F%20—-%20setup%20autoload%20——%0Arequire%20__DIR__%20.%20’%2Fvendor%2Fautoload.php’%3B%0A%2F%2F%20—-%20setting%20correct%20time%20zone%20—-%0Adate_default_timezone_set(%22Europe%2FBerlin%22)%3B%0A%0A%0A%2F%2F%20——%20Namespacing%20for%20cleaner%20code%20—–%0A%2F%2Fuse%20Monolog%5CLogger%3B%0A%2F%2Fuse%20Monolog%5CHandler%5CStreamHandler%3B%0A%0A%2F%2F%20——-%20Logging%20with%20monolog%20to%20a%20file%20——–%0A%2F%2F%24log%20%3D%20new%20Logger(’name‘)%3B%0A%2F%2F%24log-%3EpushHandler(new%20StreamHandler(‚app.log’%2C%20sLogger%3A%3AWARNING))%3B%0A%2F%2F%24log-%3EaddWarning(‚Foo‘)%3B%0A%0A%0A%0A%24app%20%3D%20new%20%5CSlim%5CApp%3B%0A%0A%2F%2F%20—–%20Example%20Hello%20World%20———%0A%2F%2F%24app-%3Eget(‚%2FHello%2F%7Bname%7D’%2C%20function%20(%24request%2C%20%24response%2C%20%24args)%20%7B%0A%2F%2F%20%20%20%20%24args%20%3D%20%24request-%3EgetAttribute(’name‘)%3B%0A%2F%2F%20%20%20%20%24response-%3EgetBody()-%3Ewrite(%22Hello%2C%20%24args%22)%3B%0A%2F%2F%20%20%20%20return%20%24response%3B%0A%2F%2F%7D)%3B%0A%0A%24app-%3Eget(‚%2F’%2C%20function(%24request%2C%20%24response%2C%20%24args)%7B%0A%20%20%20%20%24args%20%3D%20%22Hello%2C%20this%20is%20the%20home%20page.%22%3B%0A%20%20%20%20%24response-%3EgetBody()-%3Ewrite(%24args)%3B%0A%20%20%20%20return%20%24response%3B%0A%7D)%3B%0A%24app-%3Eget(‚%2Fcontact’%2C%20function(%24request%2C%20%24response%2C%20%24args)%7B%0A%20%20%20%20%24args%20%3D%20%22Feel%20free%20to%20contact%20us.%22%3B%0A%20%20%20%20%24response-%3EgetBody()-%3Ewrite(%24args)%3B%0A%20%20%20%20return%20%24response%3B%0A%7D)%3B%0A%24app-%3Erun()%3B“ message=“index.php“ highlight=““ provider=“manual“/]

Please leave a comment if this helped you and feel free to comment everything you want!

Filed Under: Blog

Reader Interactions

Schreiben Sie einen Kommentar Antworten abbrechen

Ihre E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Primary Sidebar

Neueste Beiträge

  • Gieske Baderaumsysteme
  • My Solution to Treehouse Course „Building Websites with PHP“ – Video – „Routing For Our Project“ – with SLIM 3.8
  • Weide Brandschutz & Sicherheit

Neueste Kommentare

    Kategorien

    • Blog
    • Projects
    • Impressum

    © 2025 · Martin Hoelzer · Built on the Genesis Framework