PHPackages                             ponponumi/link\_create - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ponponumi/link\_create

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ponponumi/link\_create
======================

1.0.1(2y ago)010MITPHP

Since Mar 24Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ponponumi/link_create)[ Packagist](https://packagist.org/packages/ponponumi/link_create)[ RSS](/packages/ponponumi-link-create/feed)WikiDiscussions main Synced 1mo ago

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

Link Create
===========

[](#link-create)

このパッケージは、テキストからリンクを生成するPHPパッケージです。

リンク化の対象となるものは、次の通りです。

- URL
- メールアドレス
- ハッシュタグ

Composerでのインストールについて
--------------------

[](#composerでのインストールについて)

次のコマンドを実行する事で、インストール可能です。

```
composer require ponponumi/link_create
```

このライブラリの挙動
----------

[](#このライブラリの挙動)

私のメールアドレスは、  で、ホームページは  です！

例えば、上記の文字列を、下記のHTMLに変換します！

```
  私のメールアドレスは、&nbsp;

    hoge@example.com

  &nbsp;で、ホームページは&nbsp;

    https://example.com

  &nbsp;です！
```

HTMLとして取得する場合の使い方
-----------------

[](#htmlとして取得する場合の使い方)

HTMLとして取得する場合、次の方法で取得可能です

```
use Ponponumi\LinkCreate\Web;

$text = "私は、PHPのサーバーサイド開発の方が好きかな #プログラミング #PHP";

// オプション
$option = [
  "hashtagUrl" => 'http://localhost:2230/search.php?tag={hashtag}',
];

// aタグを生成
$a = Web::create($text,$option);

// 出力結果

/*
私は、PHPのサーバーサイド開発の方が好きかな&nbsp;
#プログラミング
&nbsp;
#PHP
*/
```

HTMLの生成が面倒な場合は、こちらをご利用ください。

HTMLとして取得する場合のオプション
-------------------

[](#htmlとして取得する場合のオプション)

オプションについては、次のようになります。

### hashtagNotGet

[](#hashtagnotget)

trueの場合はハッシュタグが取得されません。

初期状態ではfalseです。

### hashtagUrl

[](#hashtagurl)

ハッシュタグ検索用のURLのベースです。

初期状態では空文字です。

実際にハッシュタグに置き換えたい部分に、 {hashtag} と記述して下さい。

この部分は、文字列以外の値を登録しないで下さい。

hashtagNotGetの設定に関わらず、この項目を設定しない場合、ハッシュタグはリンク化されません。

### emailNotGet

[](#emailnotget)

trueの場合はメールアドレスが取得されません。

初期状態ではfalseです。

### urlNotGet

[](#urlnotget)

trueの場合はURLが取得されません。

初期状態ではfalseです。

### blankMode

[](#blankmode)

これは、HTMLの target="\_blank" と rel="noopener noreferrer" を有効にするかどうかです。

挙動は次の通りです。

- 0 → 常に無効 (安全性の観点から非推奨)
- 1 → 外部リンクであれば有効
- 2 → 常に有効

初期状態では1です。

### internalUrl

[](#internalurl)

これは、内部ホストを上書きするかどうかです。

上書きする場合は、ホスト(ドメイン)か、トップページのURLを入力して下さい。

初期状態では空文字です。

この部分は、文字列以外の値を登録しないで下さい。

空文字にした場合、内部のホストは $\_SERVER\["HTTP\_HOST"\] で取得したものが使われます。

通常は、空文字にして下さい。

### hashDelete

[](#hashdelete)

trueの場合は、ハッシュタグのURL生成時、#が削除されます。

初期状態ではtrueです。

### hashEncode

[](#hashencode)

trueの場合は、ハッシュタグの部分が、urlencode関数でエンコードされます。

初期状態ではtrueです。

### nbspEncode

[](#nbspencode)

trueの場合は、半角スペースが、「&amp;nbsp;」にエンコードされます。

初期状態ではtrueです。

連想配列として取得する場合(一致データの取得)
-----------------------

[](#連想配列として取得する場合一致データの取得)

一致データの取得については、次の方法で行えます。

```
use Ponponumi\LinkCreate\Core;

$text = "メールアドレスは hoge@example.com です！";

// オプション
$option = [
  "email",
];

// リストを生成
$hit = Core::get($text,$option);

// 出力結果

/*
array(1) {
  [0]=>
  array(2) {
    ["pos"]=>
    int(9)
    ["value"]=>
    string(16) "hoge@example.com"
  }
}
*/
```

連想配列として取得する場合(整理済みデータの取得)
-------------------------

[](#連想配列として取得する場合整理済みデータの取得)

整理済みデータの取得については、次の方法で行えます。

```
use Ponponumi\LinkCreate\Core;

$text = "メールアドレスは hoge@example.com です！";

// オプション
$option = [
  "email",
];

// リストを生成
$hit = Core::arrangement($text,$option);

// 出力結果

/*
array(3) {
  [0]=>
  array(2) {
    ["text"]=>
    string(25) "メールアドレスは "
    ["link"]=>
    NULL
  }
  [1]=>
  array(2) {
    ["text"]=>
    string(16) "hoge@example.com"
    ["link"]=>
    string(16) "hoge@example.com"
  }
  [2]=>
  array(2) {
    ["text"]=>
    string(10) " です！"
    ["link"]=>
    NULL
  }
}
*/
```

こちらについては、クライアントサイドでデータの処理を行いたい場合、出力されるHTMLを調整したい場合などに向いています。

連想配列として取得する場合のオプション
-------------------

[](#連想配列として取得する場合のオプション)

配列に、次の文字列を入力すると、それぞれ取得されます。

- url → URL
- email → メールアドレス
- hashtag → ハッシュタグ

初期状態では、全て取得する設定になっています。

ライセンスについて
---------

[](#ライセンスについて)

このパッケージは、MITライセンスとして作成されています。

このパッケージは、ponponumiが作成したパッケージの他、 [piscibus様が制作した、PHP Hashtag](https://github.com/piscibus/php-hashtag)を使用しています。

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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 ~37 days

Total

2

Last Release

747d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/33330e24ced26a4d62456dc643833f584a458b10734b7988189558e6156a3668?d=identicon)[ponponumi](/maintainers/ponponumi)

---

Top Contributors

[![ponponumi](https://avatars.githubusercontent.com/u/123799676?v=4)](https://github.com/ponponumi "ponponumi (102 commits)")

### Embed Badge

![Health badge](/badges/ponponumi-link-create/health.svg)

```
[![Health](https://phpackages.com/badges/ponponumi-link-create/health.svg)](https://phpackages.com/packages/ponponumi-link-create)
```

###  Alternatives

[ivanovsaleksejs/num-to-text

Converts numbers or prices to text representation in various languages. For example, 437605 becomes "four hundred thirty seven thousand six hundred five". Price class for displaying prices with currencies is also available.

2015.9k](/packages/ivanovsaleksejs-num-to-text)[vildanbina/composer-upgrader

Effortlessly upgrade all Composer dependencies to their latest versions with a single command.

364.7k1](/packages/vildanbina-composer-upgrader)

PHPackages © 2026

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