PHPackages                             odder/lighthouse-scalars - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. odder/lighthouse-scalars

ActiveLibrary[API Development](/categories/api)

odder/lighthouse-scalars
========================

A collection of custom scalar types for usage with https://github.com/webonyx/graphql-php

0.1.3(2y ago)3800MITPHPPHP ^8.0

Since Mar 3Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Odder/lighthouse-scalars)[ Packagist](https://packagist.org/packages/odder/lighthouse-scalars)[ RSS](/packages/odder-lighthouse-scalars/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (5)Versions (5)Used By (0)

Lighthouse Scalars
==================

[](#lighthouse-scalars)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c22babb2076eaca419c617c4b19242e938ba6be8e0bd68955c6ffc0b06ec3130/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f646465722f6c69676874686f7573652d7363616c6172732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/odder/lighthouse-scalars)[![Tests Coverage](https://camo.githubusercontent.com/4028e65ca182762eb408460be73d20a72e7f6a94ca339a8d40c818c57af6e69b/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6f646465722f6c69676874686f7573652d7363616c6172733f7374796c653d666c61742d737175617265)](https://codecov.io/gh/odder/lighthouse-scalars)![PHP version](https://camo.githubusercontent.com/c7340c37ed91017a6b30d9a61b7f5c47d263cda44239d65fcfb428382247ae4c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6f646465722f6c69676874686f7573652d7363616c6172733f7374796c653d666c61742d737175617265)![webonyx/graphql-php](https://camo.githubusercontent.com/3b37f2a30ddffede3cf4468e11394e4be29da9c32136053205f450f0efa2797d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6772617068716c2d2d7068702d25354531352e302e302d626c75653f7374796c653d666c61742d737175617265)[![Total Downloads](https://camo.githubusercontent.com/1e1dbc20e7235f6aa0040ab8807f03d427058ed852db8bb3d34c4038b33ef6e1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f646465722f6c69676874686f7573652d7363616c6172732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/odder/lighthouse-scalars)[![License](https://camo.githubusercontent.com/188c64b0b2a607597a2f6284532c3f7f755ebdd7c268ca98b490cec1841282d8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f646465722f6c69676874686f7573652d7363616c6172733f7374796c653d666c61742d737175617265)](https://packagist.org/packages/odder/lighthouse-scalars)

This package provides a set of custom scalars for the [webonyx/graphql-php](https://github.com/webonyx/graphql-php) library, which is used under the hood by [Lighthouse](https://lighthouse-php.com/), a PHP port of the popular [GraphQL](https://graphql.org/) server.

Supported Scalars
-----------------

[](#supported-scalars)

The following scalars are supported:

😍😍😍:

- `Emoji` - see [Emoji](https://en.wikipedia.org/wiki/Emoji)

Numbers:

- `PositiveFloat` - see [Positive number](https://en.wikipedia.org/wiki/Natural_number)
- `NegativeFloat` - see [Negative number](https://en.wikipedia.org/wiki/Negative_number)
- `PositiveInt` - see [Positive integer](https://en.wikipedia.org/wiki/Natural_number)
- `NegativeInt`

Localization:

- `CurrencyCode` - see [ISO 4217 alpha-3](https://en.wikipedia.org/wiki/ISO_4217)
- `CountryCode` - see [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
- `Email` - see [RFC 5322](https://tools.ietf.org/html/rfc5322)
- `LanguageCode` - see [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1)
- `Locale` - Simple locale string. see [Locale](https://en.wikipedia.org/wiki/Locale_(computer_software)) (`en`, `en-US`, `en-GB`, `fr`, `fr-FR`, `fr-CA`, etc.)

Geography:

- `Latitude` - Extends GeoCoordinate. see [Latitude](https://en.wikipedia.org/wiki/Latitude)
- `Longitude` - Extends GeoCoordinate. see [Longitude](https://en.wikipedia.org/wiki/Longitude)
- `GeoCoordinate` - see [Geographic coordinate system](https://en.wikipedia.org/wiki/Geographic_coordinate_system)
- `CountryCode` - see [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)

Internet:

- `URL` - see [URL](https://en.wikipedia.org/wiki/URL)
- `URI` - see [URI](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier)
- `IPv4` - see [IPv4](https://en.wikipedia.org/wiki/IPv4)
- `IPv6` - see [IPv6](https://en.wikipedia.org/wiki/IPv6)
- `SemVer` - see [Semantic Versioning](https://semver.org/)
- `UUID` - Using UUID4. see [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier)

Markup:

- `JSON` - see [JSON](https://en.wikipedia.org/wiki/JSON)
- `HTML` - Sanitised using [HTML Purifier](http://htmlpurifier.org/) to prevent XSS attacks. see [HTML](https://en.wikipedia.org/wiki/HTML)
- `Markdown` - see [Markdown](https://en.wikipedia.org/wiki/Markdown)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require odder/lighthouse-scalars
```

Usage
-----

[](#usage)

### Using Lighthouse

[](#using-lighthouse)

You can opt-in to the scalars you want by registering them in the `TypeRegistry` in a service provider. For example, you can register the `PositiveFloat` and `Emoji` scalars in the `AppServiceProvider`:

```
use Odder\LighthouseScalars\Scalars;
use Nuwave\Lighthouse\Schema\TypeRegistry;

class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        ...
    }

    public function register(TypeRegistry $typeRegistry)
    {
        $typeRegistry->register(Scalars::PositiveFloat);
        $typeRegistry->register(Scalars::Emoji);
    }
}
```

After you have registered the Scalars you need in the `TypeRegistry`, you can use them in your schema:

```
type Query {
  mood: Emoji!
  naturalNumber: PositiveFloat!
}
```

### Testing

[](#testing)

This package includes a set of tests for each scalar. To run the tests, use the following command:

```
composer test
```

Documentation
-------------

[](#documentation)

For more information on how to use each scalar, please refer to the [documentation](https://lighthouse-scalars.odder.dev/docs).

Contributing
------------

[](#contributing)

Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to this project.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Credits
-------

[](#credits)

- [Odder](https://www.github.com/odder)
- [All Contributors](../../contributors)
- [webonyx/graphql-php](https://github.com/webonyx/graphql-php)
- [Lighthouse](https://lighthouse-php.com/)
- [Laravel](https://laravel.com/)
- [GraphQL](https://graphql.org/)

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

4

Last Release

844d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e346ed6ca0d786c0db8f9bfac44c9c68fff4cd925f346edc4fd459dbc3c61d0e?d=identicon)[Odder](/maintainers/Odder)

---

Top Contributors

[![Odder](https://avatars.githubusercontent.com/u/1289149?v=4)](https://github.com/Odder "Odder (24 commits)")

---

Tags

phplaravelgraphqllighthouse

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/odder-lighthouse-scalars/health.svg)

```
[![Health](https://phpackages.com/badges/odder-lighthouse-scalars/health.svg)](https://phpackages.com/packages/odder-lighthouse-scalars)
```

###  Alternatives

[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k11.8M117](/packages/nuwave-lighthouse)[statamic/cms

The Statamic CMS Core Package

4.8k3.6M983](/packages/statamic-cms)[joselfonseca/lighthouse-graphql-passport-auth

Add GraphQL types and mutations for login and recover password functionalities

233804.4k1](/packages/joselfonseca-lighthouse-graphql-passport-auth)[yakovenko/laravel-lighthouse-graphql-multi-schema

A Laravel package that provides multi-schema support for Lighthouse GraphQL.

16134.5k](/packages/yakovenko-laravel-lighthouse-graphql-multi-schema)[rubix/server

Deploy your Rubix ML models to production with scalable stand-alone inference servers.

642.3k](/packages/rubix-server)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1123.7k](/packages/codebar-ag-laravel-docuware)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
