Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slim Framework for beginners [closed]

How does anybody learn how to use this system?

I can't seem to find any tutorials or books or anything on how to use this program. Yes their website briefly explains a few things but there is no clarification or anything. Google has failed me.

Can anyone help me with this? I need to use this but it looks completely foreign to me.

like image 256
swhitmore Avatar asked Feb 26 '13 12:02

swhitmore


People also ask

What is the slim framework?

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs. At its core, Slim is a dispatcher that receives an HTTP request, invokes an appropriate callback routine, and returns an HTTP response. That's it.

What is slim middleware?

Middleware is a callable that accepts three arguments: a Request object, a Response object, and the next middleware. Each middleware MUST return an instance of \Psr\Http\Message\ResponseInterface .


2 Answers

UPDATE: After 3 years, It is time to add some updates to this answer. A lot has changed in slim framework (and even PHP) during this time.

Slim version 3 has been released and brought some major changes to it. In my tests, It is slightly slower and tad more complicated than slim 2, But architecture wise, it is much better, secure, suited for both large projects and small website alike.
Also, PHP has adopted really good standardization in form of PSR which I think everyone should start to adopt. Object-oriented implementation is improved a lot in 3 years and with the release of PHP 7, I don't miss my Java days anymore.

Some links to getting started.

  • Slim framework now has excellent docs, If someone is still using Slim2 it also has a decent docs.
  • A must watch Slim 3 Primer to get started. http://phpsw.uk/talks/a-slim-3-primer
  • Slim Blog is really good thing to read.
  • https://github.com/xssc/awesome-slim is a good place to bookmark.

Treehouse and few others have made some tutorials on Slim 2 as mentioned in comments, they are worth looking. Slim 3 is yet to have a beginner's tutorial videos but framework in itself is simple to understand. For simple websites, I would still recommend Slim 2 for those not really an experienced programmer. But if someone is trying to build a big professional application/product, Use Slim 3.


older answer

I will agree that slim lacks certain attentions in terms of documentation and guides. There is still no great tutorial for it, but if you have good pickup skills, Let me point you to the only worthwhile thing I found on net.

This is Presentation on the slim framework. Not a complete tutorials but it does explain certain basics to use the framework. It has helped me when I first picked up the framework. It is a Presentation By Jeremy Kendall.

The Slides can be found on slideshare.

The video is 43 min long but it is worth.

like image 64
Abhinav Kulshreshtha Avatar answered Sep 28 '22 07:09

Abhinav Kulshreshtha


This is how I did it.

I read few tutorials from people up there then I "walked" through code. Slim is really "slim", only ~50 files.

Check Slim.php file, everything starts there. See what's going on in the constructor, then see get/post methods. If you have xdebug installed then it could help you walk through one simple request and so on.

And as an added bonus you will learn a lot about PHP, patterns, basically how everything works.

P.S. My first answer here :)

like image 27
DinkoM Avatar answered Sep 28 '22 07:09

DinkoM