Download the PHP package laminas-api-tools/api-tools-doctrine without Composer

On this page you can find all versions of the php package laminas-api-tools/api-tools-doctrine. 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 api-tools-doctrine

Doctrine in Laminas API Tools

Build Status Total Downloads

🇷🇺 Русским гражданам

Мы, участники Laminas, родились и живем в разных странах. У многих из нас есть друзья, родственники и коллеги как в России, так и в Украине. Некоторые из нас родились в России. Некоторые из нас живут в России. У некоторых бабушки и дедушки сражались с фашистами во Второй мировой войне. Здесь никто не поддерживает фашизм.

У одного из нас есть украинская родственница, которая спаслась из дома вместе с сыном. Поезд задержался из-за бомбежки на дороге впереди. У нас есть друзья, которые прячутся в бомбоубежищах. Мы с тревогой ждем весточки от них после воздушных налетов, которые беспорядочно наносят удары и попадают по больницам, школам, детским садам и домам. Мы не берем это из каких-либо СМИ. Мы наблюдаем это напрямую.

Вы доверяете нам достаточно, чтоб использовать наши программы, и мы просим вас довериться нам вновь. Мы нуждаемся в помощи. Выходите и протестуйте против этой бесполезной войны. Остановите кровопролитие. Скажите "Нет войне!"

🇺🇸 To Citizens of Russia

We at Laminas come from all over the world. Many of us have friends, family and colleagues in both Russia and Ukraine. Some of us were born in Russia. Some of us currently live in Russia. Some have grandparents who fought Nazis in World War II. Nobody here supports fascism.

One team member has a Ukrainian relative who fled her home with her son. The train was delayed due to bombing on the road ahead. We have friends who are hiding in bomb shelters. We anxiously follow up on them after the air raids, which indiscriminately fire at hospitals, schools, kindergartens and houses. We're not taking this from any media. These are our actual experiences.

You trust us enough to use our software. We ask that you trust us to say the truth on this. We need your help. Go out and protest this unnecessary war. Stop the bloodshed. Say "stop the war!"

This module provides the classes for integrating Doctrine with Laminas API Tools.

Installation

Installation of this module uses composer. For composer documentation, please refer to getcomposer.org.

This library provides two modules. The first, Laminas\ApiTools\Doctrine\Server provides the classes to serve data created by the second, Laminas\ApiTools\Doctrine\Admin. The Admin module is used to create api-tools resources and the Server serves those created resources. Generally you would include Admin in your config/development.config.php and Server in your config/application.config.php.

Laminas\ApiTools\Doctrine\Server has a dependency with Phpro\DoctrineHydrationModule to handle entity hydration. See documentation and instructions on how to set up this module.

laminas-component-installer

If you use laminas-component-installer, that plugin will install api-tools-doctrine, and all modules it depends on, as a module in your application configuration for you.

For Apache installations it is recommended the AllowEncodedSlashes-directive is set to On so the configuration can be read.

API Resources

NOTE! This section was/is intended for the authors of api-tools-admin-ui. While it is possible to use these instructions to manually create Laminas API Tools Doctrine resources it is strongly recommended to use the UI.

/api-tools/api/doctrine[/:object_manager_alias]/metadata[/:name]

This will return metadata for the named entity which is a member of the named object manager. Querying without a name will return all metadata for the object manager.

/api-tools/api/module[/:name]/doctrine[/:controller_service_name]

This is a Doctrine resource route like Laminas API Tools Rest /api-tools/api/module[/:name]/rest[/:controller_service_name] To create a resource do not include [/:controller_service_name]

POST Parameters

Hydrating Entities by Value or Reference

By default the admin tool hydrates entities by reference by setting $config['doctrine-hydrator']['hydrator_class']['by_value'] to false.

Custom Events

It is possible to hook in on specific doctrine events of the type DoctrineResourceEvent. This way, it is possible to alter the doctrine entities or collections before or after a specific action is performed.

Supported events:

Attach to events through the Shared Event Manager:

It is also possible to add custom event listeners to the configuration of a single doctrine-connected resource:

Querying Single Entities

Multi-keyed entities

You may delimit multi keys through the route parameter. The default delimiter is a period . (e.g. 1.2.3). You may change the delimiter by setting the DoctrineResource::setMultiKeyDelimiter($value).

Complex queries through route parameters

NO LONGER SUPPORTED. As of version 2.0.4 this functionality has been removed from this module. The intended use of this module is a 1:1 mapping of entities to resources and using subroutes is not in the spirit of this intention. It is STRONGLY recommended you use laminas-api-tools/api-tools-doctrine-querybuilder for complex query-ability.

Query Providers

Query Providers are available for all find operations. The find query provider is used to fetch an entity before it is acted upon for all DoctrineResource methods except create.

A query provider returns a QueryBuilder object. By using a custom query provider you may inject conditions specific to the resource or user without modifying the resource. For instance, you may add a $queryBuilder->andWhere('user = ' . $event->getIdentity()); in your query provider before returning the QueryBuilder created therein. Other uses include soft deletes so the end user can only see the active records.

A custom plugin manager is available to register your own query providers. This can be done through this configuration:

When the query provider is registered attach it to the doctrine-connected resource configuration. The default query provider is used if no specific query provider is set. You may set query providers for these keys:

Query Create Filters

In order to filter or change data sent to a create statement before it is used to hydrate the entity you may use a query create filter. Create filters are very similar to Query Providers in their implementation.

Create filters take the data as a parameter and return the data, modified or filtered.

A custom plugin manager is available to register your own create filters. This can be done through following configuration:

Register your Query Create Filter as:

Using Entity Factories

By default, Doctrine entities are instantiated by FQCN without arguments. If you need anything different than that, for example if your entities require arguments in their constructors, you may specify the name of a Doctrine\Instantiator\InstantiatorInterface factory registered in the Service Manager in order to delegate instantiation to that service. Currently this can only be done by directly editing the config for your resources as follows:


All versions of api-tools-doctrine with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3 || ~8.0.0
laminas-api-tools/api-tools Version ^1.3
laminas-api-tools/api-tools-rest Version ^1.3.2
laminas/laminas-hydrator Version ^2.4.2 || ^3.0
laminas/laminas-stdlib Version ^3.3
laminas/laminas-view Version ^2.11.3
laminas/laminas-zendframework-bridge Version ^1.0
phpro/zf-doctrine-hydration-module Version ^2.0.1 || ^3.0 || ^4.1
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 laminas-api-tools/api-tools-doctrine contains the following files

Loading the files please wait ....