Programming and document language metadata for PHP applications.
ALTO Language resolves programming and document languages from slugs, aliases, extensions, and exact filenames. It returns immutable metadata with syntax markers, relationships, and common formatting conventions without inspecting file contents.
use Alto\Language\Languages;
$language = Languages::fromFilename('templates/home.html.twig');
echo $language?->name; // Twig
echo $language?->type->value; // templateThe package includes 62 lazily loaded definitions and has no runtime dependencies. Catalog tests check every slug, extension, alias, filename, and parent relationship for consistency.
Install ALTO Language with Composer:
composer require alto/languageALTO Language requires PHP 8.4 or later. It does not require additional PHP extensions.
Use the Languages facade when the identifier type is known:
use Alto\Language\Languages;
$php = Languages::get('php');
$rust = Languages::fromExtension('rs');
$python = Languages::fromAlias('py');
$make = Languages::fromFilename('/project/Makefile');Each lookup returns a Language value object or null. Use Languages::resolve() only when the
identifier may be a slug, alias, extension, or filename.
The documentation index lists these pages in site navigation order. The same documentation is published on altophp.com.
Contributions of all kinds are welcome. Visit the project on GitHub to report a bug, suggest a feature, or open a pull request.
Before submitting code, run:
# Runs PHP CS Fixer, PHPStan, and PHPUnit
composer qaChanges to public behavior should include tests and documentation.
Bundled definitions live in data/languages/. Add one file named after the
language slug; catalogue tests validate identifiers, filenames, and parent
relationships.
ALTO Language is open source and independently maintained by Simon André. If it is useful to your work, you can support its continued development through GitHub Sponsors.
Sharing the package or starring it on GitHub also helps.
ALTO Language is released by ALTO PHP under the MIT License.