Download the PHP package zfegg/zend-db-feature without Composer

On this page you can find all versions of the php package zfegg/zend-db-feature. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package zend-db-feature

Zend db features

Installation / 安装

Usage / 使用说明

TableGatewayAbstractServiceFactory 使用

TableGatewayAbstractServiceFactory 方便及明了的配置数据库和获取 TableGateway 对象. 下面介绍使用和配置

1. 确认ServiceManager 中以下两个抽象工厂类,以module.config.php为例子:

2. 数据库配置,Laminas\Db\Adapter\AdapterAbstractServiceFactory 实现了多DbAdapter(数据库适配器)的获取.

ServiceManager 中获取方式:

3. TableGatewayAbstractServiceFactory, 实现了多表的配置:

ServiceManager 中获取方式:

4. 使用实例

use Zfegg\Db\TableGateway\Factory\TableGatewayAbstractServiceFactory;
use Laminas\Db\Adapter\AdapterAbstractServiceFactory;
use Laminas\ServiceManager\ServiceManager;

$container = new ServiceManager(); //Zend ServiceManager v3
$container->configure([
  'abstract_factories' => [
      TableGatewayAbstractServiceFactory::class,
      AdapterAbstractServiceFactory::class,
  ]
]);
$container->setService('config', [
  'tables' => [
      'TestTable' => [
          'table' => 'user',
          //'invokable' => 'MyApp\\Model\\UserTable',
          'row' => true, //true will call `$table->getResultSetPrototype()->setArrayObjectPrototype(Laminas\Db\RowGateway\RowGateway);`
          //'row' => 'MyApp\\Model\\UserEntity', //set custom ArrayObjectPrototype
          'primary' => 'id',
          //'schema' => 'test',
          //'adapter' => 'db', //Set TableGateway adapter `$container->get($config['adapter'] ?: 'db'])`
      ]
  ],
  'db' => [
      'adapters' => [
          'db' => [
              'driver'   => 'pdo_mysql',
              'host'     => 'localhost',
              'database' => 'test',
              'username' => 'root',
              'password' => '',
              'charset'  => 'utf8',
          ],
      ]
  ]
]);

var_dump($container->has('TestTable'));
$table = $this->container->get('TestTable'); //TableGateway object

//TableGateway CommonCallFeature
$table->find(1);  //SELECT `user`.* FROM `user` WHERE `id` = 1

//If config ['row' => true]
$rowGateway = $table->create(['fullName' => 'test', 'email' => '[email protected]']);
$rowGateway->save();

//Fetch count
//SELECT count(1) AS `Zfegg_Db_Count` FROM `user` WHERE `email` = '[email protected]'
$total = $table->fetchCount(['email' => '[email protected]']);

//Fetch to Paginator object
/** @var \Laminas\Paginator\Paginator $paginator */
$paginator = $table->fetchPaginator(['email' => '[email protected]']);

//SELECT count(1) AS `Zfegg_Db_Count` FROM `user` WHERE `email` = '[email protected]'
$paginator->getTotalItemCount()';

//SELECT `user`.* FROM `user` WHERE `email` = '[email protected]' LIMIT 10 OFFSET 0
$paginator->getCurrentItems()';

//DELETE FROM `user` WHERE `id` = '1'
$table->deletePrimary(1);

//INSERT INTO `user` (`fullName`, `email`) VALUES ('test', '[email protected]')
$table->save(['fullName' => 'test', 'email' => '[email protected]']);

//UPDATE `user` SET `fullName` = 'test', `email` = '[email protected]' WHERE `id` = 1
$table->save(['id' => 1, 'fullName' => 'test', 'email' => '[email protected]']);

License

See MIT license File


All versions of zend-db-feature with dependencies

PHP Build Version
Package Version
Requires laminas/laminas-db Version ^2.6.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package zfegg/zend-db-feature contains the following files

Loading the files please wait ....