Download the PHP package pimcore/static-resolver-bundle without Composer

On this page you can find all versions of the php package pimcore/static-resolver-bundle. 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 static-resolver-bundle

Static Resolver Bundle

What is the Static Resolver Bundle?

The Static Resolver Bundle is a Pimcore bundle designed to encapsulate static method calls within a service-oriented architecture. It provides a straightforward mechanism to transform static methods into injectable services, promoting a cleaner, more testable, and well-organized codebase.

In many PHP applications, including Pimcore, static methods are commonly used for utility functions and global operations. While convenient, static methods have several drawbacks:

  1. Testing Difficulties: Static methods are hard to mock in unit tests
  2. Tight Coupling: Code using static calls is tightly coupled to the implementation
  3. Hidden Dependencies: Static dependencies aren't explicit in class constructors

The Static Resolver Bundle addresses these issues by wrapping static calls in service classes that can be properly injected and mocked.

Architecture

The bundle follows a consistent pattern for each static class it wraps:

  1. Contract Interfaces: Define the methods that will be available (e.g., DbResolverContractInterface)
  2. Contract Implementations: Implement the interfaces by wrapping static calls (e.g., DbResolverContract)
  3. Bundle-specific Interfaces: Extend the contract interfaces and are marked as internal (e.g., DbResolverInterface)
  4. Bundle-specific Implementations: Extend the contract implementations and implement the bundle-specific interfaces (e.g., DbResolver)

This layered approach allows for flexibility and maintainability while keeping the public API clean.

How to Use the Static Resolver Bundle

Installation

  1. Install via Composer:

  2. Enable the bundle in config/bundles.php:

Using Resolver Services

Instead of using static calls directly in your code, inject the appropriate resolver service and use its methods:

Before (with static calls):

After (with resolver service):

Available Resolver Services

The bundle provides resolver services for various Pimcore components:

  1. Database Operations:

    • Pimcore\Bundle\StaticResolverBundle\Contract\Db\DbResolverContractInterface
  2. Model Operations:

    • Various resolvers for DataObject, Asset, Document, etc.
  3. Library Tools:
    • Authentication, Console, Email, etc.

Benefits of Using Resolver Services

  1. Improved Testability: Services can be easily mocked in unit tests
  2. Explicit Dependencies: Dependencies are clearly visible in constructor parameters
  3. Loose Coupling: Code depends on interfaces rather than concrete implementations
  4. Consistent API: The resolver services provide a consistent API for static functionality

Example Use Cases

Database Operations

Instead of using Pimcore\Db static methods:

Use the DbResolver service:

Authentication

Instead of using Pimcore\Tool\Authentication static methods:

Use the AuthenticationResolver service:

Internal Use Examples

For internal Pimcore use, you can use the Bundle-specific Interfaces (marked as @internal). These interfaces extend the Contract Interfaces and may provide additional functionality specific to Pimcore's internal needs.

Database Operations (Internal Use)

Authentication (Internal Use)

Important Notes

Documentation Overview


All versions of static-resolver-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ~8.3.0 || ~8.4.0
pimcore/pimcore Version ^12.0
friendsofphp/proxy-manager-lts Version ^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 pimcore/static-resolver-bundle contains the following files

Loading the files please wait ....