Download the PHP package leads/core without Composer

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

leads/core

Shared core bundle for Leads projects built on the Symfony Framework. It provides HTTP payload mapping into request DTOs, DBAL-based pagination, API request validation helpers and base controller utilities.

Requirements

Installation

Register the bundle in config/bundles.php (done automatically if you use Symfony Flex):

HTTP payload mapping

Leads\Core\Payload maps an HTTP request into an immutable request DTO declared with attributes — no serializer, no per-endpoint glue code. Put #[Payload] on a controller argument and the bundle's value resolver builds, casts and validates the DTO:

Every constructor parameter declares its source: #[FromBody], #[FromQuery], #[FromPath] or #[FromHeader('Name')]. Values are cast to the parameter type (scalars, \DateTimeImmutable, backed enums, nested DTOs, collections via a @param list<...> docblock) and then run through the Symfony Validator (constraint attributes on the DTO). Additional behavior attributes:

Misconfiguration (missing source attribute, unsupported type, nested constraints without #[Assert\Valid], …) fails fast with a \LogicException when the plan is compiled — not at request time.

Errors are reported per field with JSON-pointer-style paths (body/items/0/quantity, query/limit): casting failures throw a 400, validator violations a 422, plus 413 for oversized and 400 for malformed bodies. All of these implement Leads\Core\Payload\Error\HttpProblemException, and the bundled PayloadExceptionListener turns them into RFC 9457 application/problem+json responses automatically. StateConflictException (409) is available for domain-level conflicts in the same format.

The component is extensible from the consuming project: implement Leads\Core\Payload\Cast\ValueCaster or Leads\Core\Payload\Source\ValueSource in your application and autoconfiguration tags it (leads_core.payload.caster / leads_core.payload.source) — no configuration needed.

You can also call the mapper directly instead of using the resolver: inject Leads\Core\Payload\PayloadMapper and call map(MyRequest::class, $request).

Pagination

Page-based pagination over a Doctrine DBAL QueryBuilder. The Leads\Core\Pagination namespace is excluded from container autowiring — instantiate the classes manually:

paginate() returns a ListResponseDTO:

The total is computed by wrapping your query in a COUNT(*) subquery (with ORDER BY stripped), so it stays correct for queries with GROUP BY or DISTINCT. Pagination throws \InvalidArgumentException if page or perPage is less than 1.

To paginate a different data source, implement Leads\Core\Pagination\PaginationInterface (getItems(int $offset, int $limit): array and getTotal(): int) and pass it instead of DBALPagination.

ClickHouse

ClickHousePagination runs the same DBAL QueryBuilder-built query against ClickHouse via the smi2/phpclickhouse client. The package is an optional dependency — install it in your project first:

Constraints:

API validation and base controller

ApiValidator wraps the Symfony Validator: it validates an object against its constraint attributes and throws ApiValidationException if there are violations. The exception exposes the violations as getErrors() — a list of ['property' => ..., 'message' => ...] pairs, also JSON-encoded into the exception message.

Controllers can extend BaseAction to get validation plus JSON response helpers:

Available response helpers:

ApiValidatorInterface is autowired to ApiValidator by the bundle; you can also inject it directly into your own services.

Exceptions

The Leads\Core\Exception namespace provides ready-to-use domain exceptions. All of them extend \RuntimeException and carry an HTTP-like status code in getCode(), so an exception listener can map them to responses directly. Each constructor accepts an optional custom message, code override and previous throwable:

License

MIT


All versions of core with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
doctrine/dbal Version ^4.0
phpdocumentor/reflection-docblock Version ^6.0
psr/log Version ^3.0
symfony/dependency-injection Version ^8.1
symfony/event-dispatcher Version ^8.1
symfony/http-foundation Version ^8.1
symfony/http-kernel Version ^8.1
symfony/config Version ^8.1
symfony/type-info Version ^8.1
symfony/validator Version ^8.1
symfony/yaml Version ^8.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 leads/core contains the following files

Loading the files please wait ...