Reputation: 39
Hi I am little bit confused about helpers and libraries both are do the same thing and helpers can do all those work which can a libraries do then what is the use of library and how can we decide where to use helper and where to use library?
Upvotes: 0
Views: 116
Reputation: 4340
Libraries are groups of related functions. So for example say you want to connect and work with Twitter. You might create a Twitter Library with all associated Twitter connectivity/retrieval functions. You wouldn't however create a Twitter helper as there are simply too many elements / functions required/involved.
You could in theory put all the twitter functions in a single helper file however that is the key between procedural and OOP. Libraries are classes, helpers (with multiple functions) would be procedural. And that is a much wider debate !!
Helper functions can be called anywhere in your code - so if you need to use the helpers in say a View and a controller they are available globally.
Upvotes: 1