PHPackages                             fuko-php/open - 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. fuko-php/open

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

fuko-php/open
=============

Generates links to open referenced files directly in your IDE or editor, or have it linked to an online repository

1.1.1(4y ago)132MITPHPPHP &gt;=7.1

Since Jun 6Pushed 4y ago1 watchersCompare

[ Source](https://github.com/fuko-php/open)[ Packagist](https://packagist.org/packages/fuko-php/open)[ RSS](/packages/fuko-php-open/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

Fuko\\Open [![Latest Version](https://camo.githubusercontent.com/1c1c324a56e081158e07d2876363404702506dda22215407f4de45af6f205827/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66756b6f2d7068702f6f70656e2e737667)](https://packagist.org/packages/fuko-php/open) [![GitHub license](https://camo.githubusercontent.com/5b68c28229bca4de100b7f57d930c87d3b962975fb4bcb7fcfee163fbd77d5ec/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f66756b6f2d7068702f6f70656e2e737667)](https://github.com/fuko-php/open/blob/master/LICENSE)
======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#fukoopen--)

**Fuko\\Open** is a small PHP library that helps you to generate links for opening referenced files directly in your IDE or editor, or have it linked to an online repository.

Basic Use
---------

[](#basic-use)

At the heart of it is all is the `\Fuko\Open\Link` class, which is really simple: it takes a format to use in its constructor, and then using that format it creates a formatted link to a code reference identified by its **file** and **line**:

```
include __DIR__ . '/vendor/autoload.php';
use \Fuko\Open\Link;

$link = new Link('source-code://%s:%d');
$href = $link->link(__FILE__, __LINE__);
```

The format is `sprintf()`-based, with two placeholders: first one is `%s` for the file, and the second one is `%d` for the line. That's it, it's pretty simple.

### Translating Paths

[](#translating-paths)

There are occasions when leading portions of the filenames must be "translated" to something different, like when:

- like when you get the real path to a file after some of its parent folders was a symlink that was resolved to its real source;
- like when you've mounted a shared network volume with your web server machine, and you want to use the locally mounted names, and not the remote ones
- or like when you are using Docker and you want to translate the Docker-based filenames to your locally-accessible filenames.

For all of those cases, the `\Fuko\Open\Link` objects have the ability to replace leading filename prefixes. You can add a new prefix for translating a file path like this:

```
include __DIR__ . '/vendor/autoload.php';
use \Fuko\Open\Link;

$link = new Link('source-code://%s#%05d');
$link->addPrefix(getcwd() . '/', '/upside/down/');
$href = $link->link(__FILE__, __LINE__);
// source-code://%2Fupside%2Fdown%2Fdemo.php#00023
```

You can add multiple prefixes, as usually there is more than one symlinked folder in most projects.

```
include __DIR__ . '/vendor/autoload.php';
use \Fuko\Open\{Link, Editor};

$href = (new Link(Editor::ATOM))
	->addPrefix(getcwd() . '/', '/upside/down/')
	->addPrefix('/private/tmp', 'tmp')
	->link(__FILE__, __LINE__);
```

Editor Links
------------

[](#editor-links)

There are several IDEs and editors that support special URL format for local files with the purpose to allow them to open them directly. This feature will only work if you are running your code locally, so that your source code files are accessible to the editor.

To generate such URLs you must use the format associated with that editor:

```
include __DIR__ . '/vendor/autoload.php';
use \Fuko\Open\Editor;
use \Fuko\Open\Link;

/* I have Atom installed locally, so this is what I want to use */
$editor = new Link(Editor::ATOM);
```

Once you have created the `\Fuko\Open\Link` object, you call its `link()` method to get the generated and formatted URL:

```
echo $editor->link('/var/www/html/index.html', 2);
// atom://core/open/file?filename=%2Fvar%2Fwww%2Fhtml%2Findex.html&line=2
```

The `\Fuko\Open\Link::link()` method is also called if you do `\Fuko\Open\Link::__invoke()`, so you can also just do this:

```
echo $editor('/var/www/html/index.html', 2);
```

### Editor Sniff

[](#editor-sniff)

You can *sniff* what editor is installed locally by using `\Fuko\Open\Sniff::detect()`. It will either return the editor link format found, or if nothing is found it will return `NULL`.

```
include __DIR__ . '/vendor/autoload.php';
use \Fuko\Open\{Link, Sniff};

/* I have Atom installed locally, so this is how you can detect it */
$format = (new Sniff)->detect();
if ($format)
{
	echo (new Link($format))->link('/var/www/html/index.html', 2);
	// atom://core/open/file?filename=%2Fvar%2Fwww%2Fhtml%2Findex.html&line=2
}
```

The sniffing is done using "sniffer" functions/methods. There are some that are built-in, but you can add your own using `\Fuko\Open\Sniff::addSniffer()`. The sniffers must return either the format to use in the `\Fuko\Open\Link` constructor, or an empty string if there is no match.

```
$sniff->addSniffer(function()
{
	return getenv('EDITOR') === 'subl -w'
		? \Fuko\Open\Editor::SUBLIME
		: '';
});
```

### Supported Editors

[](#supported-editors)

This is the list of the IDEs and editors supported by **Fuko\\Open**

EditorFormat Const[Atom](https://atom.io)`\Fuko\Open\Editor::ATOM`[GNU Emacs](https://www.gnu.org/software/emacs)`\Fuko\Open\Editor::EMACS`[Espresso](https://www.espressoapp.com)`\Fuko\Open\Editor::ESPRESSO`[IntelliJ IDEA](https://www.jetbrains.com/idea)`\Fuko\Open\Editor::IDEA`[Mac Vim](https://macvim-dev.github.io/macvim)`\Fuko\Open\Editor::MACVIM`[Apache NetBeans](https://netbeans.apache.org)`\Fuko\Open\Editor::NETBEANS`[Nova](https://nova.app)`\Fuko\Open\Editor::NOVA`[PhpStorm](https://www.jetbrains.com/phpstorm)`\Fuko\Open\Editor::PHPSTORM`[Sublime Text](http://www.sublimetext.com)`\Fuko\Open\Editor::SUBLIME`[TextMate](https://macromates.com/manual/en)`\Fuko\Open\Editor::TEXTMATE`[Visual Studio Code](https://code.visualstudio.com)`\Fuko\Open\Editor::VSCODE`[VSCodium](https://vscodium.com)`\Fuko\Open\Editor::VSCODIUM`Repo Links
----------

[](#repo-links)

There are situations in which you do not want to create links to local source code files, but instead link to your code repository. Code repo source links usually contain not just the workspace/account/project and the repo name, but also the branch/tag/commit at which you reviewing the code. To create repo links use the `Fuko\Open\Repo` class, which will help you to get a new `\Fuko\Open\Link` object with the repo link format setup inside:

```
include __DIR__ . '/vendor/autoload.php';
use \Fuko\Open\Repo;

$repo = new Repo(Repo::GITHUB,
	getcwd() . '/',	// cloned repo root folder which must be stripped from the link
	'fuko-php',	// workspace (aka project or account)
	'open',		// name of the repository
	'master'	// branch, tag or commit
	);

echo $repo->getLink()->link(__FILE__, 42);
// https://github.com/fuko-php/open/blob/master/tests%2FRepoTest.php#L42
```

There constants inside the `Fuko\Open\Repo` class to help you with the formats for the different source-code hosting websites:

- `Fuko\Open\Repo::BITBUCKET` is for [Bitbucket Cloud](https://bitbucket.org)
- `Fuko\Open\Repo::GITHUB` is for [GitHub](https://github.com)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

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

Total

4

Last Release

1708d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.3.0

1.1.0PHP &gt;=7.1

### Community

Maintainers

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

---

Top Contributors

[![kktsvetkov](https://avatars.githubusercontent.com/u/694812?v=4)](https://github.com/kktsvetkov "kktsvetkov (34 commits)")

---

Tags

atom-editorbitbucketeditorfukofuko-phpgithubnetbeans-idesublime-textlinkeditorfukofuko-php

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fuko-php-open/health.svg)

```
[![Health](https://phpackages.com/badges/fuko-php-open/health.svg)](https://phpackages.com/packages/fuko-php-open)
```

###  Alternatives

[froala/wysiwyg-editor

A beautiful jQuery WYSIWYG HTML rich text editor. High performance and modern design make it easy to use for developers and loved by users.

5.4k306.9k3](/packages/froala-wysiwyg-editor)[jbroadway/urlify

A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.

6737.4M62](/packages/jbroadway-urlify)[ckeditor/ckeditor

JavaScript WYSIWYG web text editor.

5234.2M76](/packages/ckeditor-ckeditor)[stfalcon/tinymce-bundle

This Bundle integrates TinyMCE WYSIWYG editor into a Symfony2 project.

2692.9M24](/packages/stfalcon-tinymce-bundle)[yajra/laravel-datatables-editor

Laravel DataTables Editor plugin for Laravel 5.5+.

1186.1M2](/packages/yajra-laravel-datatables-editor)[misd/linkify

Converts URLs and email addresses in text into HTML links

1122.9M10](/packages/misd-linkify)

PHPackages © 2026

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