Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68120 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63402 invoked from network); 15 Jul 2013 13:19:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jul 2013 13:19:45 -0000 Authentication-Results: pb1.pair.com header.from=florinpatan@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=florinpatan@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.46 as permitted sender) X-PHP-List-Original-Sender: florinpatan@gmail.com X-Host-Fingerprint: 209.85.219.46 mail-oa0-f46.google.com Received: from [209.85.219.46] ([209.85.219.46:42638] helo=mail-oa0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 38/49-21836-0F6F3E15 for ; Mon, 15 Jul 2013 09:19:44 -0400 Received: by mail-oa0-f46.google.com with SMTP id h1so15598587oag.19 for ; Mon, 15 Jul 2013 06:19:41 -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=H7d0lVIKmxT43nLAs9dHU3plc3oLEsW97WVdO2VXesA=; b=fYr0f8mfcOqxEFjhAO3CK4yK0gxH35PSxY03RroyEjrVQcprKfL48ZGfo7/o46OC0Z bh0/r1G5dcCqjAwDRekl4kxRe1Wv97CCix+bs9iDzByXnhvwJg3+wKRXrr47CgxDpLJ0 OOG0dEEl2N3xXepOz2miNI5D5gFRxJAzhpj3d28ls8UILrStbTH/hwCDg1P5PZq9mjGU jO9QWh0px9cxSN8dnW4NteR4lfceWwECOM6PPfGCyR2EAYDg46ny88W0K2f9fJ3O2hWW yEBCRDYa0ZpjuAtEDkhcZnj8077m3iVEd7ffowWMXLX0hyv6X1A0SdEfjR2gpSQnRHJM cZ2A== X-Received: by 10.182.72.170 with SMTP id e10mr16500461obv.62.1373894381826; Mon, 15 Jul 2013 06:19:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.180.194 with HTTP; Mon, 15 Jul 2013 06:19:11 -0700 (PDT) In-Reply-To: References: Date: Mon, 15 Jul 2013 15:19:11 +0200 Message-ID: To: Giuseppe Ronca Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] PHP proposal on modular systems From: florinpatan@gmail.com (Florin Patan) On Sun, Jul 14, 2013 at 12:13 PM, Giuseppe Ronca wrote: > Php is now used by many CMS, many of which use a modular system with a wide > range of add-ons developed by third parties. This can cause various > conflicts, such as when two or more external components using the same > library (i.g. with a different version) in this case the classes / > namespace will be in collision. This can become unmanageable by the > webmaster because they are not always able to change third parties code and > there aren't other "clean" methods to solve this kind of problem ( complex > and dirty eval methods excluded ). > > here you are a thread related to this issue: > http://stackoverflow.com/questions/17628475/php-include-different-version-of-same-library > > *One possible solution* would be to extend the scoping for the inclusions > of files using something like:* local_include_** > > in this way you can also create a sort of "nesting" system for classes > making possible a syntax like this: > > class foo { > public static function bar () { > local_include "test.php" / / file which includes "test" class; > return new test (); > } > } > > echo get_class (foo :: bar ()) / / output: "test" > > new test () / / raise an error instead > > > *Also this could work:* > > namespace {oldversion > local_include / lib/api-1.0/library.php; > } > namespace {newversion > local_include / lib/api-2.0/library.php; > } > > $ oldlibary = new oldversion \ Library (); > $ newlibrary = new newversion \ Library (); > > It shouldn't have backward compatibility issues since it's a new > implementation and you shouldn't change anything else. > What do you think about that? Hello, I've had the following problem about two weeks ago... Environment used: Symfony2 app + Composer + : - I was using version 0.2-dev of a certain library - the app was using 0.1.x of the library. Unfortunately v0.2 decided to change some of the configuration properties, and a couple of classes, all not documented. What would happen in this case if PHP would have a versioning system for the modules/libraries? How would Symfony2 be able to cope with that? Jumping from Symfony2 to any other script out there, how will this change affect the other applications out there? The way I'd see this would be to include the notion of global libraries to Composer, with versioning and so on. Then, once people get used to this concept, move Composer to PHP (not necessarily in C), just like GO has 'go get' for example, or Python pip. Best regards, Florin ---- Florin Patan https://github.com/dlsniper http://www.linkedin.com/in/florinpatan