Download the PHP package cmatosbc/ananke without Composer

On this page you can find all versions of the php package cmatosbc/ananke. 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 ananke

Ananke

PHP Lint PHPUnit Tests PHP Composer Latest Stable Version License

A flexible PHP 8+ service container that supports conditional service instantiation. This package allows you to register services with multiple conditions that must be met before the service can be instantiated.

Requirements

Features

Installation

Basic Usage

Multiple Conditions

Services can have multiple conditions that must ALL be satisfied before instantiation:

Condition Decorators

Ananke provides a powerful set of condition decorators that allow you to compose complex condition logic:

Not Condition

Negate any condition:

Cached Condition

Cache expensive condition evaluations:

AND/OR Conditions

Combine multiple conditions with logical operators:

XOR/NOR Conditions

For more complex logical operations, you can use XOR (exclusive OR) and NOR conditions:

Complex Condition Compositions

Combine decorators for complex logic:

Service Types

Ananke supports two types of service instantiation: Singleton and Prototype.

Singleton Services

Singleton services are instantiated only once and the same instance is returned for subsequent requests. This is useful for services that maintain state or are resource-intensive to create.

You can also clear singleton instances when needed:

Prototype Services

Prototype services create a new instance every time they are requested. This is the default behavior and is ideal for services that should not share state.

Changing Service Types

You can change a service's type after registration:

Best Practices

  1. Caching: Use CachedCondition for:

    • External API calls
    • Database queries
    • File system checks
    • Any expensive operations
  2. Composition: Build complex conditions gradually:

    • Start with simple conditions
    • Combine them using AND/OR
    • Add negation where needed
    • Cache at appropriate levels
  3. Naming: Use clear, descriptive names:

    • Negated: prefix with 'not-'
    • Cached: prefix with 'cached-'
    • Combined: use descriptive action names
  4. Testing: Test complex conditions thoroughly:
    • Verify each sub-condition
    • Test boundary cases
    • Ensure proper short-circuit evaluation
    • Validate cache behavior

Real-World Use Cases

1. Environment-Specific Services

Control debug tools based on environment:

2. Feature Flags and A/B Testing

Implement feature toggles with multiple conditions:

3. Database Connection Management

Safe handling of database-dependent services:

4. License-Based Feature Access

Control access to premium features:

Error Handling

The service container throws specific exceptions:

Testing

Run the test suite:

The tests provide detailed output showing the state of conditions and service creation:

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the GPL-3.0-or-later License - see the LICENSE file for details.


All versions of ananke with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
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 cmatosbc/ananke contains the following files

Loading the files please wait ....