davedevelopment / phpmig

Simple migrations system for php
Other
568 stars 92 forks source link

Suggests/Request/Proposal : Separate Adapter. #152

Open amsitlab opened 3 years ago

amsitlab commented 3 years ago

Why not separating adapter as sub-package of phpmig/phpmig

For example, for codeigniter user, their not need Zend, Illuminate, Doctrine adapter, their can install specific adapter for codeigniter(only) like phpmig/phpmig-adapter-codeigniter, and package phpmig/phpmig-adapater-codeigniter will depends phpmig/phpmig as core.

then codeigniter user can install with:

{

.....
  "require": {
    "phpmig/phpmig-adapter-codeigniter": "*",
     .....
  }

....
}

project tree of phpmig/phpmig : (core)

+-- src/
|     +- Adapter/
|     |      +- File/Flat.php
|     |      +- Pdo/ (all \Phpmig\Adapater\Pdo\  class files)
|     |      +- AdapterInterface.php
|     +- Command/(all class of \Phpmig\Command ).php
|     +- Migration /(all class of \Phpmig\Migration ).php
|     +- [other files]
+-- [other files]
+-- composer.json

And project tree of phpmig/phpmig-adapter-codeigniter :

+-- src/
|     +-- Adapter/
|           +-- Codeigniter/
|                  +-- Db.php
+-- composer.json

and phpmig/phpmig-adapter-codeigniter/composer.json be like:

{
......
"require": {
    "phpmig/phpmig": "<version>",
 }
......
}

with this methode, codeigniter user will haven't class Phpmig\Adapter\ {Zend, Illuminate, Doctrine} cause their installing spasific adapter for codeigniter (only).

also for zendframework user, their can installing specific adapter package like phpmig/phpmig-adapter-zend and project tree of phpmig/phpmig-adapter-zend be like:

+-- src/
|    +-- Adapter/
|           +-- Zend/
|                 +-- (all adapter class for zf ) .php
+-- composer.json

you can use it for each adapter. Thanks.

davedevelopment commented 3 years ago

Hi there

It's definitely something you could do, but for such as small library I don't think it's worth it.