<commit_before>---
layout: default
title: URIs extension
---

# Creating other URI objects

## Creating a simple URI object

Let say you want to create a `telnet` class to handle telnet URI. You just need to extends the <code>League\Uri\Schemes\AbstractUri</code> object and add telnet specific validation features to your class. Here's a quick example that you can further improve.

~~~php
<?php

namespace Example;

use League\Uri\Schemes\AbstractUri;

class Telnet extends AbstractUri
{
    /**
     * Supported Schemes with their associated port
     *
     * This property override the Parent supportedSchemes empty array
     *
     * @var array
     */
    protected static $supportedSchemes = [
        'telnet' => 23,
    ];

    /**
     * Validate any changes made to the URI object
     *
     * This method override the Parent isValidUri method
     * When it returns false a InvalidArgumentException is thrown<commit_msg>supportedSchemes should be supported_schemes (#100)<commit_after>---
layout: default
title: URIs extension
---

# Creating other URI objects

## Creating a simple URI object

Let say you want to create a `telnet` class to handle telnet URI. You just need to extends the <code>League\Uri\Schemes\AbstractUri</code> object and add telnet specific validation features to your class. Here's a quick example that you can further improve.

~~~php
<?php

namespace Example;

use League\Uri\Schemes\AbstractUri;

class Telnet extends AbstractUri
{
    /**
     * Supported Schemes with their associated port
     *
     * This property override the Parent supported_schemes empty array
     *
     * @var array
     */
    protected static $supported_schemes = [
        'telnet' => 23,
    ];

    /**
     * Validate any changes made to the URI object
     *
     * This method override the Parent isValidUri method
     * When it returns false a InvalidArgumentException is thrown
{'fraction_non_alphanumeric': 0.07172774869109948, 'fraction_numerical': 0.0036649214659685864, 'mean_word_length': 3.1453362255965294, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5771132', 'n_tokens_mistral': 521, 'n_tokens_neox': 496, 'n_words': 219}