Vendors in CakePHP

8 08 2007

While looking around just now I found a post complaining about vendors for not working like regular Cake magic includes such as the association variables.

This is from the original post

But I become strange when I tried to attach some personal library. They develop a shit name “vendor” to connect external library. This is really bad news because they just attach this file with the script and if you have attached a class you have to call the class to make object.

They then go on to complain that they can’t use Cakes database functions in their libraries. If you are writing code “libraries” specifically for CakePHP then it should probably be a Component, Behaviour or Helper.

The reason vendors() is the way it is is because Cake makes no assumptions about 3rd party classes or libraries.

For example: vendors(‘my_library’) will load my_library.php but there my not be a MyLibrary class in the file. In fact there may not even be any classes in there. Therefore Cake cannot automagically create a $this->MyLibrary variable.

When using vendors() you are left to use the library the old fashioned php way. i.e load, instatiate, use.

Cake makes things easy but it cannot support every configuration in every third party library. Sometimes you just have to do it yourself.

Advertisements

Actions

Information

19 responses

8 08 2007
Adz

Based on the other articles written by this guy, I wouldn’t be too surprised to discover he doesn’t quite understand the fundamentals of cakephp. I actually like how vendor() works because it allows arguments for constructors, which often third party classes require.

9 08 2007
Joel Moss

Well sad Geoff, well said! Some people really are a bit thick! 😉

24 08 2007
Anuj Chauhan

i am developing a project using cakephp and i also want to integrate wordpress and wikimedia in the same framework , please give me tips how to integrate both in one application

3 07 2009
Stu

I know this is old, but anyone still interested in integrating WordPress into Cakephp drop me a line, I have written a controller that uses CURL to place WP into a cake layout. You can use extra fields to pass meta information too with some minor adjustment to the layout, of course this is only tested on a basic WP configuration and highly interactive WP plugins may not like the difference between the displayed url and the actual url the install is on.

12 03 2012
megh

send me

megh

27 08 2007
Geoff

Hi Anuj,

That is a very big question, and far too big and complex to answer comprehensively.

My suggestion is get your other applications working and then wrap cake around them. See this disscussion on Cake playing nice with other applications sessions.

I would also look at how the Drake project does it’s integration with Drupal.

Geoff

15 01 2008
simeon

Frameworks are bad solution, generaly.

Use clear PHP please, and you will not have problems. Your programs will be better and faster than programs in cake.

11 09 2009
Luis

You’re wrong, while using a framework such cakePHP you dont have to reinvent the wheel each time you make a new porject, as a professional developer i’ve been enjoying cakephp for any kind of project , and reducing develoiping time while making a better and faster aplications.

Dont reinvent the wheel 😛

5 05 2010
y2k

Are u kidding?
or are u a beginner?

I’ll just tell u that Yahoo Answers is powered by Symfony Framework

13 11 2011
Tim Joyce

lol, “clear PHP”!? PHP itself is a framework…. http://trends.builtwith.com/framework

19 06 2008
alan

@simeon – I disagree. I think that for the ease of development and the attempts at standardization frameworks are a worthwhile approach. The time I save by using frameworks more than lets me buy beefier hardware to run a less optimized application.

19 07 2008
ani

how can i intigrate wordpress blog in cakephp. please tell me the steps plz .

19 07 2008
ani

how can i intigrate wordpress blog in cakephp. please tell me the steps plz .its urgent plz help me .

6 01 2009
[.::MDT::.]

Hi, I am not able to instantiate a class, after loading it as vendor.
Do you have any suggestion please?
http://www.cakephpforum.net/index.php?showtopic=1142&st=0&#entry4911

3 03 2009
Alexwebmaster

Hello webmaster
I would like to share with you a link to your site
write me here preonrelt@mail.ru

27 10 2011
jusnit

I am new bie to cake php. What is vendors and plugins folder in app folder?
what is use of it ?

19 12 2011
13 03 2012
Sameer

if u want to install wordpress or wikimedia then these are install in vendors…

7 08 2012
SEO Works

How easy is it to convert a cakephp website in to a turnkey application?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: