@hamiha I have not been using MVC for 20 years, nor have I claimed to. I've only ever worked on a few already existing MVC projects. I've completed only 3 videos (with this account) because I don't jive with the the way the instructor jumps all over the place, so I looked for other methods (including here).
@jlrdw I cloned mini3 and got it running. But, the routing isn't working as I'm serving with IIS and it seems that it uses Apache's mod_rewrite for the routing. It appears I'd need something like Laravel's Artisan serve to do development using my environment.
@jlrdw I've seen enough Laravel to know that the GET request to
/owners will call the method
ownerlist in the controller
PownersController. The examples I've seen then call a blade view in the
Maybe routes is required only because you're using MVC? Is
routes used outside MVC or is it MVC specific?
@MikeHopley I didn't know including a header file would be called routing. By the Laravel descriptions I've seen, it seems like it points (routes) to a view. But maybe I'm not understanding what routing is.
But sure, an
include_once('/includes/header.php'); does the trick. Another way is to just have an index.php with both the header and footer in the same file. Then, have a include in the body depending on what page you're on. If using
httpd.conf, you'd use mod_rewrite so all URIs lead to the index.php file, something like:
@jaydeluca Understanding why is very important in my opinion. There's no way for me to know how to use it till I know why to use it.
For example, I install Laravel and find that
welcome.blade.php is where the page is generated. I then code my entire app in that file. I don't believe I'd be using the framework as it was intended if I did that. But, without knowing what a framework is and why it's helpful, I'm probably not going to use it correctly. The point I'm at right now, that's how I would use Laravel. The app would totally work, but I think I'd be missing the why I should use a framework.
@topvillas Because learning why is as important to learning how. If you don't know the why it's hard to figure out how you should use it. Have a good vacation.
@topvillas https://laracasts.com/discuss/channels/laravel/struggling-to-understand-the-concepts-of-laravel-and-frameworks-can-you-help I used your guidelines and look forward to hearing your insightful replies.
teckel started a new conversation Struggling To Understand The Concepts Of Laravel And Frameworks, Can You Help?
I'm trying to wrap my head around Laravel and the concepts of frameworks. I'm starting from the beginning, what is a framework and why should I be using one? From Matt Stauffer's book "Laravel Up & Running", he gives the following reason why you shouldn't build a PHP application without a framework:
Let’s say you start a new web app without the benefit of a framework. Where do you begin? Well, it should probably route HTTP requests, so you now need to evaluate all of the HTTP request and response libraries available and pick one. Then a router. Oh, and you’ll probably need to set up some form of routes configuration file. What syn‐ tax should it use? Where should it go? What about controllers? Where do they live, and how are they loaded? Well, you probably need a dependency injection container to resolve the controllers and their dependencies. But which one?
I've been developing using PHP for 20 years so I have a good grasp on how I would start to build a new web app. The problem is, I wouldn't have any of the above problems. HTTP request and response libraries? How have I done this for 20 years without this being a roadblock? Router? It's a rare time when routing is even needed. But if so, a couple lines in
httpd.conf does the trick. Controllers? Maybe that requires another question as I'm not sure why I would need to label some of my code as a controller and then why would be a problem trying to figure out where to put them or how to load them? "dependency injection container"? Not sure what that is at all either.
Basically, I'm trying to figure out Laravel, but I believe I need to start with the beginning, why should I be using a framework? But, I've been unable to find "English" reasons for a framework. I'm looking for the reason for a framework so I can understand it better. If I am to properly use a framework I need to know the reason behind it. For example, if I install Laravel and then just code everything in index.blade.php using vanilla PHP, I'm probably not using the framework at all (other than slowing the app down with some unneeded routing overhead).
Thanks and I look forward to reading your replies.
@topvillas Well, because who in the world would search for "Laravel API" when they're looking for the docs? And why would anyone search for "Laravel API" or even "Laravel docs" when there's a "Documentation" link at the top of the Laravel home page? I even passed right past the API link in the menu because I was looking for documentation, not for an API interface to Laravel.
@DirkZz God bless you! The Cheats page is exactly what I'm looking for! If I could only get it to print correctly I'd be golden!
@Cronix The API docs are MUCH more what I was looking for. But, I didn't know they existed till yesterday. I still can't find a link to them, they're surely not in an obvious place, like, for example, on the Documentation tab. Oh, I just found the link, under Prologue! But, I'm sure I skipped right past that as to me the link "API Documentation" means a documentation on building an API with Laravel (like using Lumen).
In any case, the "API Documentation", while poorly named and hidden, is exactly the documentation I was looking for.
@gregrobson Thanks for your reply. Going through it I gave a good example of how the Laravel documentation is lacking. You mentioned the request object and the
segment method. I went to the request section of the documentation (https://laravel.com/docs/5.4/requests), and because it's written like a how-to manual instead of showing the methods, I couldn't find anything about the
segment method. So, I did a search on the page and nowhere on the requests doc page is any mention of segment.
So how would I ever know there was a method
segment if it's not in the docs? Quite honestly, the docs are almost useless to me as they don't clearly show what each function/method is and what it does. When I look something up like this, I can't find anything about it.
This is just an example of the frustration I have with the docs.
Thanks a ton for your assistance! This is the kind of information I was looking for that I couldn't find on the Laravel and Laracast websites. You've given me lots of information to dive into.
I guess if I was designing a framework I would make a few fundamental changes. Maybe these suggestions could be used to make Laravel more accessible and easier to learn:
Directory structure. If it uses an MVC paradigm, have root-level
controller folders. I've found
app\Http\Controllers. Not sure where the
models are yet. There's also the
routes folder which is not clear to me why there's 4 files in this folder. For projects where I do something similar with routing, I use Apache mod_rewrite and my
routes are all either in
Just extend PHP instead of making it a new language. One of the reasons I love SASS is that it's basically an extended CSS. You can just write CSS and it works, but you can also extend it to SASS-specific features. It would be a joy to use Laravel if it was more of a PHP extension where it would be for the most part standard PHP with added Laravel functions (if you wanted to use them). Same goes with Blade. It would be nice if it was basically just PHP with extensions. This would greatly reduce the learning curve.
Documentation. Maybe this goes along with #2, but if Laravel was an extension of PHP, you could easily list the new Laravel methods and how each functions. A perfect example of a great manual (for me) is php.net. A simple organized display of function grouped by type. Easily click on a function/method on the left and see what it does on the right. Currently with Laravel the manual is written more like a how-to book instead of clearly listing the functions/methods in an organised manor. For me, this causes much confusion as I can't get a clear picture of what I can do and how it's done. I want to click on a function/method and get the syntax. The description and community can comment below for more insight (again, like php.net).
teckel left a reply on Laravel - Is It Possible To Learn It In A Few Weeks?
@phpMick A "hello world" in PHP would be index.php with these contents:
<?php echo 'Hello World'; ?>
The first thing I do when using PHP without a framework is what I do for every project. I start with index.php, custom.js, style.scss and work out from there. I don't know what an ORM is, maybe I do that but don't match it to the term. Authentication is different for each project. Many times authentication code is just refactored or included from a common file. Logging is rare in my world. Logging typically happens last, to trap errors or send analytics data. No idea what a templating engine is. Maybe I do that but don't know it as the term?
It seems like what you're saying is that the things you would do for every project are what a framework is. But it seems you do things that I don't do with a project. Or, maybe I do but I just don't attach them to terms.
@RonB1985 Excellent contribution to this thread! Is this how you dismiss something that you don't agree with? What's next, Hitler and racist references? Congrats, you've lost the Internet.
@DirkZz I've asked, the answer is that makes things easy, elegant, or extendable and includes all the framework stuff that we would need to build with each project. I've asked many more questions and it's obvious that I can't ask more.
I'm not sure where you believe my arguments are contradicting each other.
What is this well maintained set of functionality? That's exactly what I'm looking for, this set of functionality that I need which doesn't exist in PHP. Also, how can one know if a framework isn't for them if they don't know what a framework is what it could do for them? Still looking for that.
I'm saying that I don't understand routing, not sure how MVC helps me, don't know what ORMs or templating engines are, and never heard of Composer till Laravel. And you're exactly right, because of Laravel, I don't fit into a team well, which is why I'm hear trying to figure it out.
I have no reason to explore other frameworks as Laravel is the only one my company is going with. Maybe Laravel is a blessing compared to other frameworks, but that doesn't change the problem I have with Laravel.
How did I go 20 years without Composer? I've re-used code many times, and built many tools/applications/websites from the ground-up without Composer. Of course I use Git for group projects.
It has nothing to do with job security. I write very easy to follow and very organized code. And I don't even understand what you mean by my custom build framework. As stated, I don't know what a framework is. The definition of a framework has yet to be defined. I don't build a framework of some kind before I start a project. I just start the project, typically with index.php, custom.js, and style.scss and go from there. There's no "framework" that I need to first build. Very confused by this. Maybe you're saying that if I've ever written anything from the ground up that it must have a framework?
@jlrdw It houses my code? Why not just organize the code in folders. Like an "account" folder for tools dealing with accounts. Or an "ajax" folder for AJAX code? I've developed in ASP and Java and never needed a framework. I've never heard of yii or cakephp till today. So, this doesn't answer my question. Folders house my code, so Laravel is just a code organizer?
I'm not a hobbyist. I develop tools/applications (typically intranet) and other times entire websites (typically with some kind of CMS but sometimes vanilla PHP). For the current company I work for, we mostly do intranet development (reports, management consoles, business logic APIs, and typical corporate intranet development). We also have a few customer-facing websites (one written in vanilla PHP) and the other in Laravel. I'm still don't feel that anyone has expressed what the advantage of using Laravel is, or even WHAT it is.
I've written a few tools using Vue, but honestly it probably takes me twice as long to do it in Vue as it does in just jQuery. The last tool I did I used jQuery instead of Vue as it just seems easier, faster, and is more understandable as there's no magic layer that makes it difficult to someone else to interpret.
@jimmck Yet you are keeping it alive by replying?
@jlrdw But what does Laravel actually DO? It seems to do nothing, and provide no advantage over vanilla PHP. To me, it seems like it's designed for those that don't know how to program from scratch, so they must rely on some kind of foundation to build from. But, I don't understand what this foundation is for or how it makes life easier. I'm sure if you've never programmed something from the ground up, and have always needed a crutch to program with, Laravel may be required and understandable. But from someone on the outside with no framework experience, it's a real head-scratcher.
@KNietzsche I always say that if in 5 minutes you can't explain something, you're not explaining it correctly. Perfect example of the tutorials here. I appreciate the effort, I just think it's misguided. I'm not trying to get you to agree with me, but my experience is valid from my perspective. I can also appreciate that others may like the training style and find it informative. Neither perspective cancels the other out, they're both valid.
@phpMick Terms like routing, middleware, controllers, views, session, etc. Typically, one terms references another term. For example, the Eloquent ORM intro references other terms which have no meaning to me. Basically, the definition of one term gives 3 other unknown terms.
I've use MVCs, but only to make changes to existing projects. I have never built anything using a MVC model, as I prefer to keep my projects better organized. I don't believe I've used a templating engine but ORM, but not 100% sure what they even are. Again, I've always written vanilla PHP (or many other languages).
@topvillas You're mistaken. I have asked for assistance, and people have suggested resources for assistance. I've also described why assistance is needed and offered suggestions to clarify things to new Laravel users. I'll excuse you for being late to the party to know this, but I suggest you scroll up to learn more.
@KNietzsche Not sure why you believe I've only watched 3 videos. I've only watched 3 videos (to completion) HERE because I got stuck (many times) in those 3 videos, so I've went out to find information from other sources (like here). Also, I'm not the type that learns from a video lecture. And the style of the 3 videos I've seen here are too hyper for me to follow. My company also has a Laracast membership so I've watched many others with a corporate account. The point is that you're making incorrect conclusions that are based upon limited information.
And I disagree with you on Jeffrey's style, I find it way to hyper to follow. Even slowing it down doesn't help as it's still all over the place. Just not my thing, to each his/her own.
The rest of your message I don't follow, seems like a rage-rant.
@topvillas That's exactly why I'm here, to try and learn it. But, I'm getting nothing but roadblocks, so I posted to the forum for assistance. Seems logical.
@KNietzsche I'm trying to find the features and possibilities with Laravel, which is why I'm here. Hard to be positive when I can't even get through the first few introduction videos without stuff breaking and terms being thrown around which I have no idea what they mean or why I would use them. In 3 months I won't be on this project anymore if it takes that long. I'm simply looking for the REAL how to get started with Laravel information. Some have suggested books and online guides, which I am going through. So far, they do seem to be MUCH better than Jeffrey's insider caffeinated puppy style. If you think I'm not trying, you're mistaken. I'm here because I have been trying for 3 weeks with very little progress. I still don't even know WHAT Laravel does. So far, all I see is a more complex way of doing very simple things.
Because the company I currently work for has decided to use Laravel for new projects. So, I need to learn Laravel. I think it's a bad decision, but it's been decided. Anyway, that's why I'm here giving you an earache.
@RonB1985 Not a troll, just a confused but experienced programmer.
I would argue that someone who reaches out for some type of framework as a crutch is the inexperienced programmer. Rolling my own applications has always worked for me, having 20 years of PHP experience.
@phpMick Thanks for the link! That may be exactly what I was looking for on both on the Laravel and Laracast websites which don't exist!
@JeffreyWay I truly have written thousands of PHP apps for the last 20 years. Full-time development for both person and commercial projects. And I truly am totally confused by Laravel and frameworks. You can dismiss this as a lie, but I believe that many people have this same confusion with Laravel (some have even posted to this thread stating the same). If it takes a month to wrap your head around Laravel, the documentation should be looked at by an outsider.
If you truly want to address this problem, an insider can't write the documentation or do the "Welcome to Laravel" videos. You're too "inside" the product to communicate with people that don't know what Laravel or frameworks are or why they need them. Or, you can stick your head in the sand and dismiss it as a lie.
I would willingly subscribe to Laracasts if there was information that made sense to me. So far, it's not my learning style. I'm more of a self-learner, and the Laracasts that I've seen are defiantly for visual learners (and those that like hot key combinations, which I only use Ctrl-C, Ctrl-V, and F3).
When I say that I rolled my own, I meant that I rolled my own applications from scratch. Obviously, if I had a need for a framework and was building them, I would know what they were. I hope that makes sense.
I just tried it again. My standard development environment is node.js, gulp, sass, auto-prefixer, and browser-sync. Obviously, 'require' isn't a client-side JS command, so it fails. Also, how would it know where to get Vue.js from? I have used Vue.js, but I do it the (to me) logical and easy way. I simply put the vue.js file in my JS folder and include it in my project's footer.
It's your choice, dismiss me as unskilled and/or a liar and continue to confuse people and create a large learning curve. Or, be open-minded to the fact that some people have used PHP/JS for decades yet don't understand what you're selling because you're only speaking to those who are already on the inside. I'm also not just complaining, I'm offering a solution. The solution is that a non-insider needs to review your documentation and getting started videos and they need to be reworked so who don't know what Laravel and frameworks are can understand how they may benefit them and also how to use them.
Again, your choice. But thanks for at least listening.
@tisuchi The Laracast training does not provide me enough to understand Laravel. I already know PHP, been using it since 97 and have built hundreds if not thousands of applications based on it (up to multi-million dollar projects). I've yet to understand a bit of Laravel or what it does. It's all concepts and nothing real. Manual is the the same.
teckel left a reply on Laravel - Is It Possible To Learn It In A Few Weeks?
@andonovn I'm 3 weeks into this and even "Hello World" tests results in Laravel crashing. The crash page shows like a dump of garbage with no real way of knowing what went wrong. Undoing my last change doesn't fix it. So, there's unknown stuff going on in the background which can't be undone.
If Laravel was a class that I could just download and include in my PHP code that would be cool. And if the documentation was clear and showed the functions/methods it included that would be great. But the documentation is obscure. Where's a list of the Laravel commands that I can use? I long for a php.net like manual, which simply lists the commands, gives examples, and has a community that comments on how they are used. Not with Laravel! I have no idea what Laravel even does, and I'm been beating my head against it for 3 weeks now. No idea why I would even want to use a framework, the website never says WHAT it does or WHY I should use it.
@joshgallagher24 People keep saying that, but I don't see it. I don't even know what a framework is or why I would need it. Now that I got Laravel to install, I would probably just take the blade that renders the home page and just write all vanilla PHP to that, as I have no idea what anything is or why I need it.
I can develop a basic report or blog-type application in a week, and have developed MANY full complex applications. I've developed multi-million dollar web systems 100% on my own. No problem with any of that. The problem is what is Laravel, what does it do, and what is it good for? Maybe it requires an understanding of certain practices, but it's unclear what those are based upon anything I read on the website or in any video.
My review: AVOID AT ALL COST!
@aurawindsurfing Oh, and I've never used a framework, nor do I know why I would. Also, I can find nothing showing me what it does for me. It's like I should already know what a framework does and why it's important. Everything I look up about frameworks don't show me anything that would be useful to me. I've always rolled my own and can think of no good reason for a framework. Maybe people only land here if they need a framework crutch to code. I never had so I'm confused why it's even needed. Very confused by all of this.
@aurawindsurfing Of course, I tried starting there. But, there were many roadblocks, jumped all over the freakin' place, and made everything VERY complicated. All the unknown terms and hoops to jump through was daunting. Also, many total stop problems and errors which stopped me at every turn. Spent 3 days trying to get through 5 of those videos, I can finally install Laravel, but can't do anything with it. No idea where to start or how anything would be setup. Like a simple CRUD app, where would this go? How many files would I need to create?
Honestly, I would probably install Laravel and then just use vanilla PHP for the entire project. As I have no idea how to actually use Laravel, or even what it does for me based on the videos.
I'm done with Jeffrey, I know you all think he's a god and wonderful to learn from. I find him not helpful at all. Way to much jumping all over the place, way too many "inside baseball" terms, no real code examples or explanations. And his cute little "you'll love it" and crap make me cringe! It's like he's added cute comments to code, which everyone hates.
teckel left a reply on Laravel - Is It Possible To Learn It In A Few Weeks?
From first-hand experience, I would say absolutely not! Laravel was designed by insiders that love to throw around insider concepts and terms that seem intentionally obscure. The documentation is also obscure and only shows how it works, but not why it works. Therefore, there's no context to any of the documentation. Further, the Laravel community seem unwilling to help, almost rude in their response to questions.
Basically, unless you MUST use Laravel, I would look elsewhere, preferably not using a framework at all, as they change with the wind and as soon as you learn one there's a better one available. Instead, stick with the vanilla with no framework or plugins.
@jlrdw We did try razor, and I have used it for a few projects. But, we've moved away from ASP totally and use strictly PHP or C# when performance is an issue (like for high-traffic APIs).
I'll look into the quickstart in 5.2 and updating it to 5.4 to try out, thanks.
@Snapey I'm purchasing the Laravel 5.4 For Beginners book today, and checking out the SQL Server link you provided.
Voyager is far too large of a package. I don't need a package to make a one-off Laravel project. The direction is going with Laravel for simple reporting, to APIs (using Lumen), to full e-commerce websites (which we've already done for part of our business).
I have no problem paying for a course or a startup package. But every online course I've tried has been a problem as they're designed for visual learners instead of a hands-on learner like myself.
So really, I'm looking for the anti-Laracast, as most of Laracast is useless to me. I need to see it work, not watch a video on how commands are formatted, I can get that from the code.
I guess I'm looking for which should be a super simple example Laravel project that connects to a super simple SQL Server database, pulls in the data, and displays it in Vue. Then, simple CRUD functions to add/delete/edit records.
This kind of thing would take about 15 minutes to whip up in vanilla PHP. So I'm sure with a framework like Laravel it would be MUCH quicker. Are there any resources out there that contain actual Laravel example code? That's really what I'm looking for as I'm not a visual learner, so the videos are about worthless to me. I just need to see a working project, and I learn by reverse engineering.
I've been trying to learn the basics of Laravel for 3 weeks now, I can't get a simple CRUD demo to work.
We don't use asp.net anymore. No one ever liked it so we're using PHP or C# for everything now. SQL Server is just the database, and Laravel supports it so it.
Obviously not a single script, many logically organized scripts. Even a simple project will have many scripts, just arranged and named in a logical way.
The documentation shows concepts (typically a line or two), but nothing substantial that one can wrap their head around how everything works together, which is the confusion. I'd rather see a working project to get a feel for how it works, rather than a single line with how a route is setup or whatever. It's all meaningless on it's own, there's no "big picture".
I try to set my .env for SQL Server but the migration examples fail with permission denied errors (when I'm using the correct permissions). I interface with SQL Server all the time via PHP so I know what the credentials are, it just doesn't work in Laravel.
I've tried going through some tutorials with older releases, those make things even worse as it seems that everything has moved.
Where are these 3 videos?
Where can I go (like today or tomorrow) to learn Laravel? I've been writing in PHP since 1997 (and other languages back to the early 80's) but this Laravel thing has got me stumped. My employer is pushing Laravel as a new project framework to make things "easier". However, I've had nothing but trouble even getting it running or doing anything with it. A simple "hello world" seems to require me to dig into a few folders and modify a few pages. One must know where these hidden folders and files are and what they do to even get the "hello world" running.
Anyway, the Laracast videos are way too confusing, jump all over the place, are too specific to the Mac, or generally just don't relate to what I need to do (for example, using SQL Server instead of MySQL). Because of this, the tutorials are painful to watch at best to totally non-functional.
So, where's the REAL Laravel resource to learn this turd of a framework?
teckel left a reply on Access And Manipulate Component Data In Other File
You're a lot further than I, I can't even get var Vue = require('vue'); to work.
"Uncaught ReferenceError: require is not defined"