Download the PHP package celema/core without Composer

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

Celema Core Framework

ci code coverage type coverage psalm level

Celema Core is a lightweight and easily extendable PHP 8.5+ web framework.

[!WARNING] This library is under active development, some of its features are still experimental and subject to change. Large parts of the documentation are missing.

It features:

Routing

App exposes the router's common route helpers and runs requests through the router RoutingHandler internally.

Request lifecycle

Let the front controller call serve():

serve() selects the runtime. Started as a FrankenPHP worker, it handles requests until the worker retires. Everywhere else (PHP-FPM, FrankenPHP's classic mode, the CLI development server) it handles the current request and returns its response. The same file works in all of them.

Every request goes through the same steps:

  1. The app opens a container scope for the request. Routing, middleware, controllers and their autowired arguments resolve through that scope, so scoped() entries get one instance per request.
  2. The error handler, if any, wraps routing, middleware and the view.
  3. The response is emitted, and the request ends where the runtime supports it: PHP-FPM and FrankenPHP, in both modes, send the response and close the connection, so the client does not wait for the teardown. The CLI development server keeps the client waiting.
  4. The teardown runs: the scope is reset (services implementing Celema\Container\Resettable are reset), then the app's teardown hooks run.

run() performs these steps for one request; handle() implements PSR-15's RequestHandlerInterface and returns the response without emitting it, which is useful in tests. In handle(), the teardown runs before the response is returned, so a response body must not depend on scoped services.

Register routes, middleware, and container entries before the first request. The first request seals the container; registering afterwards throws.

Teardown hooks

Use teardown() for resources that outlive a request and have to be brought back to a clean state after each one:

Hooks run in registration order. Each one runs even if an earlier one failed. In run() the client already has the response, so a hook can also do work it need not wait for, such as notifying other services; its output does not reach the client.

Failures

The error handler logs the server errors it answers without a matching renderer at critical, and the exceptions of a renderer entry at the level set with its log() method, as Server error {status} for {method} {path} or Client error …. The context carries the exception and the placeholder values; the path leaves out the query string, which can carry tokens. Without a logger, or when the logger fails, records go to error_log(). PHP diagnostics the handler does not turn into exceptions, deprecations by default, are logged at notice as PHP {type}: {diagnostic} in {file} on line {line}; without a logger, PHP reports them itself.

Exceptions thrown while handling a request are the error handler's job. A throwable that escapes it, or the emitter, is logged as Unhandled exception for {method} {path} through the PSR-3 logger registered with $app->logger() (otherwise with error_log()), and run() answers with a minimal 500 response if nothing was sent yet. Like PHP for an uncaught exception, that response shows the exception only while display_errors is on. In debug mode without a debug handler, the error handler lets exceptions escape on purpose, so they end up here. A failing teardown step is logged the same way; it never replaces the response that was already emitted.

Worker mode

FrankenPHP's worker mode boots the application once and keeps it in memory for many requests. Point the worker at the normal front controller:

What lives for the whole worker and what lives for one request:

The worker retires, and FrankenPHP starts a fresh one, in these cases:

Set both in the worker's environment (env CELEMA_WORKER_MAX_REQUESTS 1000 in the worker block) or pass them to serve(maxRequests: …, maxMemory: …), which wins over the environment. FrankenPHP's max_consecutive_failures stops a worker that fails while booting.

Things to keep in mind:

Development server

The development server commands live in the optional celema/server package, which runs applications with the PHP CLI's built-in server or FrankenPHP:

When the package is installed, Core's error handler automatically reports handled server errors to the development server's request log.

Development example

The repository's example app exercises routing, autowiring, request and response helpers, middleware, error handling, static assets, and request-log states. With celema/server installed, run it on port 1973 with either development server:

The server watches the example and Core source by default and restarts the workers after a change in celema/server README describes the other options, such as host, port, worker mode, and request-log filtering.

PSR-7 implementation

App::create() uses nyholm/psr7 as its PSR-7/PSR-17 implementation:

Any other implementation works through a custom Celema\Core\Factory\Factory. Extend AbstractFactory, assign the implementation's PSR-17 factories, and pass an instance to the App constructor:

Supported PSRs:

Mutation testing

Mutation testing with Infection is not part of composer ci, but the CI workflow runs it after the coverage step and enforces the minimum mutation score from infection.json5.dist. Pushes only mutate the changed lines; a weekly scheduled run covers the whole codebase. Run it locally with:

Reports are written to .infection/.

License

This project is licensed under the MIT license.

The built-in SAPI emitter is derived from laminas/laminas-httphandlerrunner (BSD-3-Clause); see the third-party code section in LICENSE.md.


All versions of core with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
ext-fileinfo Version *
ext-mbstring Version *
celema/container Version ^0.7
celema/router Version ^0.7
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0
psr/http-message-implementation Version ^1.0
psr/http-server-handler Version ^1.0
psr/http-server-middleware Version ^1.0
psr/log Version ^3.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 celema/core contains the following files

Loading the files please wait ...