Using PHP packages without Composer

I am creating a developer SDK to create modules for e-commerce platforms that will use our API for a new launch.

Obviously, it would be ideal to use the composer I'm doing right now. But since I'm reviewing most e-commerce platforms right now, or at least the most popular, they don’t use composer.

So, I am wondering what is the best way to get all the dependencies that my current packages need and build them in a standalone SDK.

Thus, I can have a version that will work both for platforms with composer support and for non-composers.

Is there a standardized way to do this in terms of design pattern? How can I organize all dependency packages in any organized way?

+4
source share
2 answers

Since these e-commerce platforms do not use the composer, this does not force you to exclude the composer from the equation. You cannot distribute your package as a plugin / module / regardless of the particular e-commerce platform, but you can still use the composer's autoloader in the production process.

, . , :

  • :

    $ mkdir -p ~/.tmp && cd ~/.tmp
    
  • :

    $ git clone <package>
    
  • 1

    $ cd ~/.tmp/<package> && composer.phar install --no-dev --optimize-autoloader
    

    :

    $ cd ~/.tmp/<package> && composer.phar install --no-ansi --no-dev --no-interaction --no-progress --no-scripts --optimize-autoloader
    
  • .git.

  • zip/tar ~/.tmp/<package>

  • .

, / , zip/tar.


1) --optimize-autoloader, Sven, , .

+1

!

, . API-, Guzzle HTTP-, : Guzzle 3, 4, 5 6?

Guzzle 3 . .

Guzzle 4 , 5 . .

5, 6. Guzzle , , , . , : - , Guzzle - .

, , Composer . , , , .

ZIP . composer.json, , .

, , , , , , : , , , , , Composer. , , .

, Guzzle - , composer.json. Guzzle ( , ). - - , , , - , Guzzle , .

? !

, . Composer - , . : .

API, , : !

, , , , , . , , .

: , Composer, , , - else code base.

, .

: , PHP-FIG , . HTTP PSR-7.

SDK API, ( ) PSR-7 SDK HTTP-, .

, , , , , , Guzzle : - Guzzle 6 SDK - , Guzzle 5 ? ! : Guzzle 6, Guzzle 5, HTTP-, PSR-7.

0

Source: https://habr.com/ru/post/1610010/


All Articles