Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68122 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70194 invoked from network); 15 Jul 2013 15:07:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jul 2013 15:07:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-wg0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:49083] helo=mail-wg0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B9/5A-21836-31014E15 for ; Mon, 15 Jul 2013 11:07:00 -0400 Received: by mail-wg0-f54.google.com with SMTP id n11so10233989wgh.33 for ; Mon, 15 Jul 2013 08:06:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=iUtCh7JYSGdfTPcodjaSKeYMt1Lu5A2pAPBoowjzdQ8=; b=s65tDjSChJzhA85zdDY5XTw6LuHjsS77Da8ow98G2hbhtw/meiOOodbUBtgwPvjkpg v3rZoaAhljo8/FQnEIynyIbIli+ASPd2PXdpeZz5iEfi57AiXMsF2QzGWk5YXxYJ0vdA pKIiwUfubFJkyWf5hWeUbSbOQh3+AtEQqAoAaOXElxk0wRQJxStT6Ss6022bo+Wv/Uly vRSElFFFBRi3GtCRwfYrcLYlsvJ2bxMNJrl/U2y/9dx+CGheJyR5b/xaBcf5j2nko8Rp kKNzpvbzL2L+YO8V/UTnBLdg5SMcB0NEnRTQ3yQ3tLaCLgajkFB7kfsGIkZl4pL7O7/6 Md0A== X-Received: by 10.194.242.99 with SMTP id wp3mr16592247wjc.78.1373900816186; Mon, 15 Jul 2013 08:06:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.151.162 with HTTP; Mon, 15 Jul 2013 08:06:35 -0700 (PDT) In-Reply-To: References: <1373879683.17031.4.camel@guybrush> Date: Mon, 15 Jul 2013 17:06:35 +0200 Message-ID: To: Giuseppe Ronca Cc: PHP Internals List Content-Type: multipart/alternative; boundary=089e013d18141b068a04e18e365f Subject: Re: [PHP-DEV] PHP proposal on modular systems From: ocramius@gmail.com (Marco Pivetta) --089e013d18141b068a04e18e365f Content-Type: text/plain; charset=UTF-8 On 15 July 2013 16:51, Giuseppe Ronca wrote: > I'm not talking about this kind of problem... > I think you know how a CMS works ... we've for example : > > * *CMS sources that are developed by Joomla devs ( i.g ) with theirs > libraries.* > * *Plugin (A) developed externally and installed by the final user, that > includes inside its sources pclzip library ( the version and library > doesn't matter) .* > * *Component (B) developed externally and installed by the final user, that > includes inside its sources pclzip library again.* > That's why you got two names for a different implementation of the same thing. You can't call your own thing the same as the original one: it's not the same. That would even confuse the consumer, which doesn't know if it's the original or the new one. > > Now ..since that library could not be installed in CMS by default, since > devs of the Plugin (A) can't know if needed library is installed ( at their > needed version ) inside another component...*we will have ofc a name > collision when both plugin and component will be loaded.* > That's actually one of the problems solved by composer... > It could be also a problem of various languages...but classes in local > scope / nested are a known technique used by different languages..and php > could implements it even better. > These classes still live under their own package, and their fully qualified name is different from all others. > In this way any CMS/Extension can arbitrary decide to use load their > components/library in a private scope ( avoiding collision ) . > i.g: > > class Loader { > public static function LoadComponent () { > local_include "foo_component/loader.php"; > } > } > This is really coupled to your own system and with how extensible you design it. You may look at modern PHP frameworks to see how the problem of extensibility is solved: it's mainly a DI/configuration issue that has nothing to do with class names. PS i'm not so practice with composer ( used few times ) but when modular > systems , such as CMS , give the possibility to extends them with external > components...i don't think that composer could solve this problem. > It is actually already happening. You should really really really check it out before going further in exploring already explored grounds. Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --089e013d18141b068a04e18e365f--