Yii Framework Forum: Composer Support - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Composer Support

#1 User is offline   tbekos 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 29-July 12

Posted 23 January 2013 - 07:10 AM

Will Yii 2 utilize composer packages?
0

#2 User is offline   CeBe 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 469
  • Joined: 16-July 10
  • Location:Berlin. Germany

Posted 23 January 2013 - 10:15 AM

Yes.
0

#3 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,312
  • Joined: 17-January 09
  • Location:Russia

Posted 23 January 2013 - 05:17 PM

Yes was about extensions. Yii2 itself divided to independent packages, not likely.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#4 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 566
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 28 January 2013 - 06:46 AM

Will you force developers to include a composer.json file to get his package listed at yiiframework?
I would suggest it, as packagist does.

What's about splitting up Yii like symfony? see https://github.com/s...ymfony-standard
E.g. the zii widgets could be a separate package.

Another thing to think about is, how Yii handles dependencies to libs like jquery. I often had conflicting versions with Yii, jQuery and jQuery Plugins.
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#5 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,312
  • Joined: 17-January 09
  • Location:Russia

Posted 29 January 2013 - 04:28 AM

Yes, we will.

Zii most probably will be a separate package.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#6 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 566
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 10 March 2013 - 10:40 AM

@samdark: Here's an interesting posting from a Joomla-Dev about splitting up the core into composer packages and interface handling.
https://groups.googl...Vo/hi4EqUPGKNUJ

Btw: For extensions I'd recommend a composer package type 'yii-extension' and 'yii2-extension' respectively. There may also be packages with the types 'yii-theme' and 'yii-application'.
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#7 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 566
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 13 March 2013 - 12:38 PM

@samdark, @qiang: What's the status of composer integration in Yii 2? Like application bootstrapping and extension conventions (namespaces, etc...), or an extension repository.

I talked to several Yii users/devs in the past weeks and we'd like to know about the implementation plans, so we can port as much of them back into Yii 1.x

For sure I'd also have tons of input for you about this topic. ;)


Looking forward to hear from you,
schmunk
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#8 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,312
  • Joined: 17-January 09
  • Location:Russia

Posted 13 March 2013 - 12:56 PM

The focus now is on the core itself. I think composer will be probably handled after alpha.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#9 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 566
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 29 March 2013 - 01:14 PM

Have you already made a decision about using packagist.org or an own repo?
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#10 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,312
  • Joined: 17-January 09
  • Location:Russia

Posted 29 March 2013 - 02:18 PM

No. Any advices?
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#11 User is offline   Suralc 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 10-January 12
  • Location:Germany

Posted 29 March 2013 - 04:51 PM

Will yii-extensions have their own package type, or will they just work out of vendor. Makes no difference to the user (packages are required as usual), but would seperate yii-specifics from general purpose packages.

http://composer.github.com/installers/

FYI: Their is allready an install-type for yii-1.1 extensions and modules:
https://github.com/c...a36244e52cd90f6
0

#12 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,312
  • Joined: 17-January 09
  • Location:Russia

Posted 29 March 2013 - 05:43 PM

I haven't considered this option. Can you explain how it works?
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#13 User is offline   yiqing95 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 586
  • Joined: 27-December 10
  • Location:china

Posted 29 March 2013 - 09:11 PM

View PostSuralc, on 29 March 2013 - 04:51 PM, said:

...
FYI: Their is allready an install-type for yii-1.1 extensions and modules:
https://github.com/c...a36244e52cd90f6


:lol: well done !
0

#14 User is offline   ekerazha 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 525
  • Joined: 10-October 08
  • Location:European Union

Posted 30 March 2013 - 04:39 AM

View Postsamdark, on 29 January 2013 - 04:28 AM, said:

Zii most probably will be a separate package.


I hope with different names, like "jQuery UI package" etc.:D
Yii user #37
0

#15 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 566
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 30 March 2013 - 09:02 AM

Hi,

for the "tl;dr" - guys, just read the bold parts ;)


I am very glad Suralc raised the composer installer topic.
Thanks to his posting I just noticed, that there is an Yii installer already.

But the current implmentation of the Yii installer is pretty useless, it is doing things wrong and raising problems, IMHO.

To be honest, I haven't tried it out, but it is pretty obvious what it does.

The installer would put a package of the type "yii-extension" into protected/extensions and one of the type "yii-module" into protected/modules, when you run composer update or install.

First, if your application has a different directory structure than a standard Yii Web Application Skeleton it will fail, because the destination directories are missing. Moreover it is just using the package name without the vendor name, which may lead to additional conflicts.

Second, even if you have the directories mentioned above, you'll still have issues versioning your project, because you may mix up your own code, like in modules, with code, which is managed by composer.
Usually, you just commit composer.lock for the code you get from composer, because if you run composer install you'll get the exact revisions, which have been written to this file, see this link for more info.

Luckily, as layed out in this wiki article, you don't need to place your extensions and modules in the directories mentioned above, even for Yii 1.1.

An exception are themes, because this is code you'll very likely going to modify and an installer may be useful here. But developers have to require the installer in their theme package and moreover the installer also has to be able to find out your theme directory.

The installer directories should not be hardcoded, because we would loose the ability to define custom dir-structures for our projects.

Because of all the points now mentioned I sticked with composer script events, for Phundament, which are way more flexbile than installers.
As an example, it's very easy to run migrations or setup directory permissions when installing an extension or copying theme files into the right place, just by executing yiic commands.

There may be a way to enhance the installers, but I found it more complicated than using the script events - Let me know if someone has ideas how to accomplish this.

So here's my summary for the installers:

  • Yii2 should use the vendor/ folder for project extensions, custom modules may go into modules/ and extensions not available via composer go into extensions/
  • Yii2 should introduce these composer types "yii2-extension", "yii2-theme" and "yii2-application" (similar to the web app skeleton) - which would be important for searching through a large number of packages and also using installers later on.



I think this is the right time to link to some "Yii Application Standard Request" docs we've creeated, which treat the same subject, please note that they are just proposals! And we'd be very happy about feedback.





So now on to the question where to host the package information.

You've basically two options:

1. packagist.org

Pros:
+ the main composer repository, existing packages are there already
+ easy to use, repo is preconfigured in composer.phar
+ available as Open Source from https://github.com/composer/packagist (but it's a Symfony project ::))

Cons:
- a bit slow, due to the large number of packages
- you're relying on infrastructure from someone else


2. Do it on your own with Yii and satis

Pros:
+ policy could be to only allow Yii extensions and , which would be faster and cleaner
+ may be a Yii project
+ you're relying on your infrastructure

Cons:
- you'll have to build a web frontend on your own
- users would have to include that repo in composer.json
- a package may be registered at packagist.org and packages.yiiframework.com


But as a summary for the hosting topic:
I'd use packagist.org.


Best regards,
schmunk
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
1

#16 User is offline   Suralc 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 10-January 12
  • Location:Germany

Posted 30 March 2013 - 11:53 AM

View Postyiqing95, on 29 March 2013 - 09:11 PM, said:

:lol: well done !



Not mine. I was just lurking through the composer documentation. My projects usually have no protected dir placed in the webroot.


However, yii should support variable structures. And I'm not yet convinced that composer can handle packages distributed to several places inside an app with the current flexibility of yii.
0

#17 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,312
  • Joined: 17-January 09
  • Location:Russia

Posted 30 March 2013 - 04:41 PM

Wow. Thanks for your input. Really useful.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users