Download the PHP package jdz/fontmanager without Composer

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

JDZ Fonts Manager

Utility to manage a local web fonts database

Description

FontsDb keeps a folder of web fonts indexed by YAML files. It fetches font families from remote providers (Google Fonts, google-webfonts-helper), copies the TTF files of the variants you ask for, converts them to WOFF / WOFF2 subsetted to the requested character sets, and gives back each variant's properties and file paths so you can write the @font-face rules. Fonts you drop into the folder yourself (local fonts) are indexed the same way.

Installation

Requirements

Optional: symfony/dotenv to load GOOGLE_FONTS_API_KEY from a .env file (see .env.dist).

Usage

A full walk-through (check, install, get, with and without the provider catalogs) is in examples/example.php.

Querying a font

Every query method takes (string $family, string|int|null $weight = null, ?string $style = null, ?array $subsets = null):

API

JDZ\FontManager\FontsDb

Method Description
__construct(string $fontsPath, array $formats = ['ttf', 'woff2', 'woff']) The fonts folder and the formats every installed variant must have
addProvider(Provider $provider): self Register a remote font provider
load(bool $prefetch = false): self Index fonts.yml and the font folders; true also loads the provider catalogs and saves
loadDistantFonts(bool $save = false): self Load the provider catalogs (once)
isAvailable(...): bool The font is known, the variant and subsets exist
isInstalled(...): bool Available, and its files are present in every format
check(...): void Same as isInstalled(), but throws a FontException subclass saying what is missing
install(...): void Download the variant's TTF from the first provider that has it, generate the missing formats, save the index
has(...): bool / get(...): object\|false Whether an installed variant exists / its data and file paths
save(): void Write the YAML index files (also called on destruct)

Providers (JDZ\FontManager\Providers\)

Class Source
GooglefontsProvider(?string $googleFontsApiKey = null) Google Fonts Developer API (https://www.googleapis.com/webfonts/v1/webfonts); without an argument the key is read from $_ENV['GOOGLE_FONTS_API_KEY']
MrandtlfProvider google-webfonts-helper API (https://gwfh.mranftl.com/api/fonts)
Provider Abstract base: implement fetchList(): array and fetchInfos(string $id, string $family): object\|false to add a source

Exceptions (JDZ\FontManager\Exceptions\)

FontException (with getFontError()), FontNotAvailableException (unknown family), VariantNotAvailableException (unknown variant; lists the available ones).

Folder layout

A local font is a folder laid out the same way by hand (local: true in its font.yml, a TTF in each variant folder); the missing WOFF / WOFF2 files are generated when the folder is loaded. Local fonts are never installed from a provider.

Tests

Changelog

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

(c) Joffrey Demetz [email protected]


All versions of fontmanager with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
ext-curl Version *
symfony/yaml Version ^7.4
symfony/filesystem Version ^7.4
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 jdz/fontmanager contains the following files

Loading the files please wait ...