A
A
Anton Kravchenko2019-01-25 17:32:55
git
Anton Kravchenko, 2019-01-25 17:32:55

How to include files from a GitHub repository?

Good day!
I am engaged in finalizing the CRM system for various clients, and in the course of work I have designed various integrations of this CRM with other systems in the form of PHP files on GitHub. Repository - ClientbasePro/Integrations . I write a separate file for each integration. For example, a separate file for integration with Yandex.Telephony YandexTelephonyFunctions.php, a separate file for integration with the SMS service IQSMSFunctions.php, etc. All files are located in this one repository.
I connect clients like this: on hosting / VPS I create a ClientbasePro folder, I put the composer.json file in it with the following content

{
    "require": {
        "php":">=5.3.0",
        "ClientbasePro/Integrations":"dev-master"      
    },
    "repositories":[
        {
            "type":"git",
            "url":"https://github.com/ClientbasePro/Integrations"
        }      
    ]
}

and connect autoloader
require 'ClientbasePro/vendor/autoload.php';
Next, I set up composer update via cron to always have up-to-date versions of PHP files.
The problem is that all PHP integration files are downloaded by all clients.
The question is, how do I set up a local composer.json file or something else for each client so that only the files they need are loaded from the shared repository **/Integrations?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
Tom Nolane, 2019-01-25
@tomnolane

create different branches? one for you, another/other for clients? The branch name contains the meaning of the plug-in. This is the simplest option + .gitignore
More complex - using submodule
ps
you have only one master branch -> this is not good. Be sure to share. You can do this:
branch:
1) dev - development, new features, bug fixes, new version of the product
2) master or release1-> main production branch
3) IQSMS + release1/dev
4) YandexTelephony + release1/dev

A
Arthur K., 2019-01-25
@amark

I would suggest that you regulate the connection of the necessary modules with a config file for each client. The config file can be called some client-specific name, something like: client_muha.cfg.php, client_slon.cfg.php
And I would suggest doing the organization of the branch space in Git more traditionally, for example, according to the Git Workflow principle .

A
Anton Kravchenko, 2019-01-27
@AntonKravchenko

while setting up .gitignore, synchronization broke (

[RuntimeException]                                                                                                   
  Source directory /var/www/html/ais/include/ClientbasePro/vendor/ClientbasePro/Integrations has uncommitted changes

I have to delete the whole folder and re-sync with composer.
Apparently, it is better to create and connect a separate repository for each integration:
ClientbasePro/YandexTelephonyIntegration
ClientbasePro/TelphinTelephonyIntegration
, etc.
Thanks to all who answered!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question