Download the PHP package gsu-cetloe/cetloelib-php without Composer

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

cetloelib-php

Shared PHP library for CETLOE applications. One Composer package, five namespaces under Cetloe\.

What it does

This library is built for command-line PHP tools that read some configuration, call an API or two, and write a log. It is the plumbing those tools share, so each one is left with only its own commands.

The center of it is a bootstrap. You point ApplicationInvoker::run() at your application directory and namespace, and it does the rest:

  1. Loads .env from that directory into a typed Env object (via Symfony Dotenv).
  2. Scans src/ and loads every class under your namespace.
  3. Builds a PHP-DI container. Any class you write that extends DefinitionSource is picked up automatically, and sources can declare other sources they depend on.
  4. Finds your commands by their #[AsCommand] attribute and registers them with a Symfony Console application. Commands are only instantiated when one is actually run.
  5. Hands a Monolog logger to anything that implements LoggerAwareInterface, including every command.
  6. Runs the application and exits with its status code.

A bin/ script for a tool built on this looks like:

Your commands extend Cetloe\Console\Command\Command instead of Symfony's. That base class logs when a command starts and finishes, and if it throws, logs the full exception chain in a stack-trace format before letting the error propagate.

Logging goes to LOG_DIR/<app name>.<date>.log by default, with each line stamped with the time elapsed since the process started. With no LOG_DIR set, it goes to stdout. LOG_LEVEL, LOG_NAME, LOG_FILE_FORMAT, and LOG_FORMAT override the rest.

For talking to HTTP APIs, extend HttpAPIClient. It gives you PSR-17 request building, form-encoded bodies, and a sendRequest() that throws a typed exception when the status code isn't one you asked for: NotFoundException for 404, TooManyRequestsException for 429, and so on. The exception carries the request and response so you can inspect them.

Cetloe\Utils is the odds and ends: ArrayValue pulls typed values out of loose arrays (handy for env vars and decoded JSON), FileMethods wraps the file functions that return false on failure so they throw instead, and JSON does the same for encoding and decoding.

Each piece can be used on its own. You can take the HTTP client without the console bootstrap, or the container without the logger.

The namespaces:

Namespace What it provides
Cetloe\Container Extensions for PHP-DI and Symfony Dotenv.
Cetloe\Console Extensions and DI bindings for Symfony Console.
Cetloe\HttpClient Extensions for the Guzzle HTTP client and DI bindings for PSR-17 and PSR-18.
Cetloe\Logger Extensions for Monolog and DI bindings for PSR-3.
Cetloe\Utils Common utility classes for arrays, files, and JSON.

Setup

This project uses Composer for package and script management. Install Composer by following the instructions at https://getcomposer.org/download/, then run:

Using the library in a project

Checks

PHPStan runs at level 9 with the strict, deprecation, and PHPUnit rule sets. PHP_CodeSniffer checks PSR-12. PHPUnit runs the test suite with warnings, notices, deprecations, and stray output all treated as failures. Run everything with:

Or one at a time:

Caches and scratch files from these tools land in working/, which is ignored by git.

Tests

Tests live in tests/ and mirror the src/ layout. They use real objects throughout: a real PHP-DI container, real Monolog handlers writing to a scratch directory, and a real Symfony Application. The HTTP client tests replay canned responses through Guzzle's MockHandler so no network is involved.

tests/Fixtures/App is a small fixture application (commands, a definition source, a logger-aware service, and a set of shapes) that the Container, Logger, and Console tests load through the same Env and ClassRepository path a real application would use.

See TESTPLAN.md for the manual checklist.

History

This library started as the mjfklib packages (console, container, httpclient, logger, utils) by Melody Joy Kimball. They were merged into a single package when the project moved to the GSU-CETLOE organization. See LICENCE.md.


All versions of cetloelib-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-dom Version *
guzzlehttp/guzzle Version ^7.8
guzzlehttp/psr7 Version ^2.6
monolog/monolog Version ^3.5
php-di/php-di Version ^7.0
psr/log Version ^3.0
symfony/console Version ^6.3.8
symfony/dotenv Version ^6.3
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 gsu-cetloe/cetloelib-php contains the following files

Loading the files please wait ...