Page 1 of 1
How do libraries work? [solved]
Posted: Wed Sep 26, 2007 10:44 am
by lafflin
Hello, I'm not sure this question is in the right place, but I just have a simple question. How do libraries work? Is a library placed in an external file that you can place into your directory and call functions from? I'm a newb and I'm trying to take it to the next level, but it seems like all the library sites assume that I know how to implement them, but I don't.
Thanks for any guidance given.
Posted: Wed Sep 26, 2007 10:58 am
by feyd
Libraries are generally a grouping of independent code. They may be one or more functions and/or classes. They are not applications in themselves and are typically not an platform to build an entire application on -- those are called frameworks. Instead they focus on a specific task. Examples of libraries range from the MySQL functions found in PHP to Swift Mailer to my SHA256 implementation.
Posted: Wed Sep 26, 2007 11:17 am
by Luke
To continue on feyd's explanation, libraries generally allow you do do complicated tasks, but give you an interface that is more easy to work with. For example, mailing 1000 customized emails with attachments and only one To: parameter might be pretty tedious task if you were to do it without a library. With swiftmailer, it's relatively simple.
To use libraries, you simply
include (or
require) the files you want to use, and follow the
documentation outlined on the library's site. If the library has bad docs, don't use it. No library should assume you know how to use it. One of the deciding factors when I'm choosing a library is good documentation.
Posted: Wed Sep 26, 2007 4:10 pm
by lafflin
Hey guys, thanks alot. That was exactly what I needed to know. I feel like a a big door was just unlocked that leads to a warp zone.