How to organize a common code on the Bonus website: by subdomains

How do I organize my site to use shared packages? Lets use Stackexchange as an example. There are many subdomains:

webapps.stackexchange.com         namespace StackExchange\webapps
programmers.stackexchange.com     namespace StackExchange\programmers
etc.

Each of the subdomain reuse libraries. Maybe there is a question class that is reused by all sites to help the layout ask a question page.

Will a package of questions be packaged in each of the packages of subdomains? Or all packages refer to a package of questions. In other words: what scenario takes place:

StackExchange\webapps\question
StackExchange\programmers\question

OR

StackExchange\webapps
StackExchange\programmers
StackExchange\question
WHERE StackExchange\Webapps and StackExchange\programmers use StackExchange\question

, . . , , , , .

, , -, ? ?

+4
2

, -, . , .

, .

Vendor\Package Vendor\Site\Package .

, , - ( ), ( ).

: () .

- , . rm-vanda answer , . Composer.

pro . . PHP, APC OpCache, , .

- . , . "vendor" , ( , -). , .

. , , .

  • ? , .
  • , , , - ? .
  • .

, Composer . Composer - , .

+1

, php.ini include ---

.

/usr/share/php/

- ( )

-

ini_set('include_path', get_include_path().".:/var/www/path/for/this/project");

, :

require_once '/usr/share/php/apis/Google_Client.php';

+1

All Articles