I've never used composer. Actually in the last decade 95% of the php code I maintained was written by either myself or 1 other co-worker and the other 5% I eventually read every line of code enough times to mostly understand how it all worked. So I have almost no experience working with other people's code and the idea of building 25% to 75% of a project by pulling in other people's packages is foreign to me.
Can anyone suggest a good tutorial that walks you through building an actual application using primarily packages available through Composer?
Composer based tutorials?
Moderator: General Moderators
-
thinsoldier
- Forum Contributor
- Posts: 367
- Joined: Fri Jul 20, 2007 11:29 am
- Contact:
Composer based tutorials?
Warning: I have no idea what I'm talking about.
Re: Composer based tutorials?
http://code.tutsplus.com/tutorials/easy ... -net-25530
That does a good job of covering the basics. There's no magic to Composer, really. You're pulling in namespaced packages and using them elsewhere in the application you're building. If you understand namespaces, it should be pretty straightforward. If not, give these a read:
http://php.net/manual/en/language.namespaces.php
http://www.phptherightway.com/#namespaces
That does a good job of covering the basics. There's no magic to Composer, really. You're pulling in namespaced packages and using them elsewhere in the application you're building. If you understand namespaces, it should be pretty straightforward. If not, give these a read:
http://php.net/manual/en/language.namespaces.php
http://www.phptherightway.com/#namespaces
-
thinsoldier
- Forum Contributor
- Posts: 367
- Joined: Fri Jul 20, 2007 11:29 am
- Contact:
Re: Composer based tutorials?
I've used composer once or twice to download a class but what I'm really looking for is: Today we're going to build a web app that does X,Y,Z using the following community packages for features Xa, Xb, Ya, Yb, Xc, and Za.Celauran wrote:http://code.tutsplus.com/tutorials/easy ... -net-25530
That does a good job of covering the basics. There's no magic to Composer, really. You're pulling in namespaced packages and using them elsewhere in the application you're building. If you understand namespaces, it should be pretty straightforward. If not, give these a read:
http://php.net/manual/en/language.namespaces.php
http://www.phptherightway.com/#namespaces
Warning: I have no idea what I'm talking about.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Composer based tutorials?
The issue will not be using Composer for packages x, y and z. It will be getting you app using Composer's autoloader scheme, which means writing simple composer.json file for you app. Then you just need to add something like:
Code: Select all
require __DIR__ . '/vendor/autoload.php';(#10850)
-
thinsoldier
- Forum Contributor
- Posts: 367
- Joined: Fri Jul 20, 2007 11:29 am
- Contact:
Re: Composer based tutorials?
Maybe I should have called this post "Small Community Library based tutorial" where someone has already created their app using mostly pre-existing code from the community and then their tutorial is about why they chose the packages they chose and the process of making them work together. Aside from the phpMailer class and my co-worker & boss I've NEVER used anyone else's code! So I'm looking for an "explain it tome like I'm a 5 year old: how do you use other people's code?" kind of thing.
Warning: I have no idea what I'm talking about.
Re: Composer based tutorials?
I don't know of any tutorials aimed specifically at what you're looking for, and writing one from the ground up also involves writing an app from the ground up. It's quite a bit of work. Do you have a small project you'd like to integrate some third-party components into? Maybe refactor out some NIH code for something a little more robust? I'd be happy to work with you to achieve that.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Composer based tutorials?
Have you looked at the composer.json files for various framework apps? The files are pretty simple. Once you have your code working, then add other libraries.
(#10850)