Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return a formatted string
<?php sprintf(string $format, mixed ...$values): string
<?php     public function url(): string

    {

        return sprintf(

            '%s/%s/%s.%s',

            $this->base,

            $this->type === self::PNG ? '72x72' : 'svg',

            implode('-', $this->codepoints),

            $this->type

        );

    }



    public function jsonSerialize()
<?php it('can generate url', function (string $emoji, string $twemoji) {

    assertEquals(

        sprintf('https://twemoji.maxcdn.com/v/latest/svg/%s.svg', $twemoji),

        Twemoji::emoji($emoji)->url()

    );

})->with('emojis');
<?php it('can generate SVG url', function (string $emoji, string $twemoji) {

    assertEquals(

        sprintf('https://twemoji.maxcdn.com/v/latest/svg/%s.svg', $twemoji),

        Twemoji::emoji($emoji)->svg()->url()

    );

})->with('emojis');
<?php it('can generate PNG url', function (string $emoji, string $twemoji) {

    assertEquals(

        sprintf('https://twemoji.maxcdn.com/v/latest/72x72/%s.png', $twemoji),

        Twemoji::emoji($emoji)->png()->url()

    );

})->with('emojis');
<?php it('can generate custom url', function (string $emoji, string $twemoji) {

    assertEquals(

        sprintf('https://twemoji.astrotomic.info/svg/%s.svg', $twemoji),

        Twemoji::emoji($emoji)->base('https://twemoji.astrotomic.info')->url()

    );

})->with('emojis');