Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialHemed Al tiwani
3,658 PointsWhat are these monolog, Slim and Twigs?
HI, Please can any one help me I want to know what are these things and what is meaning of package and framework and why don't we just use PHP from start to end instead of these other things? I hope you understand my question
6 Answers
Kevin Korte
28,149 PointsThey're bits of functionality. Slim is a micro-framework, which is written in PHP and gives you tools to more quickly build your web app. Twig helps create re-usable and dynamic views within the Slim framework, and Monolog appears to be a logger to help a dev see the inner working so their app better.
Why use these tools instead of start from scratch? You can, but you can equate these packages as tools. If you're building a house, you can get premade tools to help you build your house faster, or you can first build your own tools, than build your house. Same end result, you just got there a different speeds.
Casey Cross
9,289 PointsI agree as well. I have been dragging my feet through this PHP course because it is so far beyond my current understanding. I'm just doing what he does but half the words that come out of his mouth are unexplained and I don't feel like I could do any of this on my own, unlike the html/css courses. Luckily I just noticed treehouse added a new class two days ago https://teamtreehouse.com/library/build-a-basic-php-website that will hopefully broaden my understanding of what the heck we're doing here! I'm taking this class next!
kabir k
Courses Plus Student 18,036 PointsYeah, some parts of it aren't well-explained.
Daniel P
3,362 PointsThis lessons are confusing and treehouse should reconsider if this is the right way to learn PHP. You barely manage to gather bits and bytes with functions, and the suddenly there is some framework. I understand that your point is to show that the code can be accomplished quicker and smarter, but this is not the time to explain that, it's to soon. In my opinion, we should build some simple webpage (with little or no CSS), with some field like contact form..or similar.
Bonnie Martin
13,671 PointsI have to agree. I really kind of hate this method of learning PHP :( Plus, NONE of this works with Slim version 3, which is the current version. Trying to find the current ways to do each step is really frustrating. I'm basically giving up at this point because as a beginner, I'm having to figure out all of it from scratch since version 3 is really different.
Kevin Korte
28,149 PointsWhy not follow along using Slim 2? You don't have to use the latest version if you're not ready for it yet.
Bonnie Martin
13,671 PointsBecause it would be silly to invest so much time and effort into learning an outdated version. It's very different now.
Kevin Korte
28,149 PointsIt's not silly, not the least bit. A few points to think about, and then you can make your own decision.
Frameworks are generally structured the same. Even among different languages. I haven't looked heavily at Slim 3, but core concepts (i.e. best practices) will remain. Sure, some things depreciated, some things added, maybe the structure of the framework changed, but there are a lot of core principles to learn
Somewhat contradicting to that is the effort and cost to move an actual existing site to an updated framework. In the real world, you will likely run into "outdated" versions of frameworks. Many companies, especially smaller companies might not see the ROI or have the time to update from Slim 2 to Slim 3. This means you as a developer must be capable of understand the core concepts of the framework, and the differences between them.
It gives you the opportunity to test yourself as a developer. You're frustrated trying to do this Slim 2 course in Slim 3. Use this as your benchmark, take the Slim 2 course with Slim 2, than use what you learned, and your documentation reading skills to build it again in Slim 3. See how much easier it is.
This is exactly what I did with the Laravel 4 lessons here, building the app again in Laravel 5 on my own after. Or the social media app Treebook here in Rails 3, where I tried to rebuild it in Rails 4.
I think you'll learn more, than just following a straight up Slime 3 course.
Legacy code is always a problem. Learning legacy frameworks is never a waste of time in my humble opinion. Wishing you the best.
Dan Varnau
7,681 PointsI completely agree with all of this. I feel like I'm learning how to do specific things using shortcuts and in the future when I need to do something differently, I'm not going to have the knowledge of how to do it. These courses have largely been copy/paste and tada! It's a web page. I didn't feel that way with the html/css/js courses. Those gave me a much much better grasp on the concepts. Learning how to code using pure PHP first would be a lot more helpful.
Hemed Al tiwani
3,658 PointsHemed Al tiwani
3,658 PointsThanks a lot Kevin
Antonija Pek
5,819 PointsAntonija Pek
5,819 PointsDo you think this is the right way to introduce PHP to beginners? There is a way to make CMS without using OOP or frameworks, maybe it should be starting point to understand the concept and then show OOP and various frameworks.
Kevin Korte
28,149 PointsKevin Korte
28,149 PointsI don't know, to be honest. I'm not a teacher, and I haven't studied learning patterns. I do know I learned PHP without OOP, frameworks, or other tools, and spent some time coding 100% from scratch. Good for learning but I didn't build much.
I think there is a fine balance to be considered. If you start a new person off with too much of a from scratch perspective, they won't understand why they're learning what they are learning. Sure, you could teach me all about classes and constructors, but if I don't understand how they fit in the big picture of a web app, I could loose interest.
The other imbalance is using framework and tools too heavily to where I know how to use a slim class, but I have no idea how the class actually works. Which means I can't do anything outside of what I can get pre-built for me, and that's not good either.
People also learn differently, so there is no perfect answer. But i think it's important to find a blend of quickly scaling apps so you see the big picture, and feel accomplished, while slowly understanding the intricate parts of the language.
Nick Davies
7,972 PointsNick Davies
7,972 PointsBut wouldn't creating this code yourself be more efficient as it would have no unnecessary code?
Kevin Korte
28,149 PointsKevin Korte
28,149 PointsMaybe, maybe not Nick.
If you knew what you were doing, you might be able to write something faster. That's a possibility, sure. It would also be possible to write something slower even if it was less code. One thing you gain from these tools is you get to leverage a lot of work from other people, for free. For instance, Slim right now has 1,422 commits and 97 contributors. Another benefit is the security side of it.
It would be hard for a small team, to build the same functionality, lighter and faster. Picking the right tool is important however. Don't use Laravel when you Slim or Lumen can provide all you need.
It makes sense for small teams to build upon these platforms. Later, if your site scales you may find yourself need to rewrite off to a custom framework. But at that point you would have the resources and people to make that possible.
They have their place, they just need to be use be used responsibly. I think you have more to gain optimizing the front end.
Lumen says that slim 3 can handle 1800 request per second, and Lumen 1900. That's pretty speedy as is.