Skip to content

Repository files navigation

ALTO Language

Programming and document language metadata for PHP applications.

  PHP Version   CI   Packagist   License   GitHub Sponsors

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; // template

The package includes 62 lazily loaded definitions and has no runtime dependencies. Catalog tests check every slug, extension, alias, filename, and parent relationship for consistency.

Installation

Install ALTO Language with Composer:

composer require alto/language

ALTO Language requires PHP 8.4 or later. It does not require additional PHP extensions.

Quick Start

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.

Documentation

The ALTO Language documentation covers:

Contributing

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 qa

Changes to public behavior should include tests and documentation.

Bundled definitions live in data/languages/. Add one file named after the language slug; the catalog consistency tests validate its identifiers, filenames, and parent relationship.

Support

ALTO Language is open source. You can support its continued development through GitHub Sponsors.

Sharing this package with others or starring it on GitHub is also much appreciated.

License

ALTO Language is released by ALTO PHP under the MIT License.

About

Programming language metadata: 60+ languages with extensions, aliases, filenames, and syntax markers

Topics

Resources

Code of conduct

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Contributors

Languages