PHPackages                             andresilva/clipboard - 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. andresilva/clipboard

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

andresilva/clipboard
====================

Cut, copy and paste values inside your app.

v1.0.1(2y ago)055MITPHPPHP 8.\*

Since May 9Pushed 2y agoCompare

[ Source](https://github.com/andre-silvakmm/Clipboard)[ Packagist](https://packagist.org/packages/andresilva/clipboard)[ Fund](https://github.com/sponsors/DarkGhostHunter)[ Fund](https://paypal.me/darkghosthunter)[ RSS](/packages/andresilva-clipboard/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Clipboard
=========

[](#clipboard)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5c444655e1657ef3a24df1be4192f844a2613cf61477eb9904f0bc5d6a37962c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c617261676561722f636c6970626f6172642e737667)](https://packagist.org/packages/laragear/clipboard)[![Latest stable test run](https://github.com/Laragear/Clipboard/workflows/Tests/badge.svg)](https://github.com/Laragear/Clipboard/actions)[![codecov](https://camo.githubusercontent.com/617f8890776d6c53f501eeea168225a874a7f7eca711ca41a5e590a0fc5f9240/68747470733a2f2f636f6465636f762e696f2f67682f4c617261676561722f436c6970626f6172642f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d496f326178794f786e59)](https://codecov.io/gh/Laragear/Clipboard)[![Maintainability](https://camo.githubusercontent.com/a44dfa760135121effe0f0b1813c6cf9dec623c08c1a9a2abb5dc752c1763808/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f65623562313734363830303165623831393233642f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/Laragear/Clipboard/maintainability)[![Laravel Octane Compatibility](https://camo.githubusercontent.com/70359a356da237cd29561bc5d0bb80baae775b5ff62f288ed324755382858342/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2532304f6374616e652d436f6d70617469626c652d737563636573733f7374796c653d666c6174266c6f676f3d6c61726176656c)](https://laravel.com/docs/9.x/octane#introduction)

Copy, cut &amp; paste in your application. You read that right.

```
use Laragear\Clipboard\Facades\Clipboard;

public function foo()
{
    Clipboard::copy('test');
}

public function bar()
{
    Clipboard::paste(); // 'test'
}
```

Become a sponsor
----------------

[](#become-a-sponsor)

[![](.github/assets/support.png)](https://github.com/sponsors/DarkGhostHunter)

Your support allows me to keep this package free, up-to-date and maintainable. Alternatively, you can **[spread the word!](http://twitter.com/share?text=I%20am%20using%20this%20cool%20PHP%20package&url=https://github.com%2FLaragear%2FClipboard&hashtags=PHP,Laravel,FoolsDay)**

Requirements
------------

[](#requirements)

- PHP 8 or later
- Laravel 9, 10 or later

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

[](#installation)

You can install the package via composer:

```
composer require laragear/clipboard
```

Usage
-----

[](#usage)

The Clipboard works like your normal clipboard in your application.

MethodDescription`copy()`Copies a value into the clipboard.`cut()`Moves a value into the clipboard, assigning it `null` on the current context.`clone()`Clones an object into the clipboard.`paste()`Pastes a value previously copied in the clipboard.`pull()`Pastes a value previously copied, removing it from the Clipboard.`clear()`Clears the clipboard value.Using the Clipboard to move around values inside the application allows you to avoid registering things into the Service Container unnecessarily, or moving a value around using functions or the cache.

### Copy and paste

[](#copy-and-paste)

Copying a value will copy the reference of the object, or the value if is a primitive like a `string`, `int` or an `array`, among others. It works like any other function.

```
use Laragear\Clipboard\Facades\Clipboard;
use App\Models\Article;

$article = Article::find(5);

// Copy a value
Clipboard::copy($article);

// Edit the reference after has been copied.
$article->title = 'The new title!';
```

Pasting will paste the value how many times you want. It accepts a default value in case the clipboard is empty.

```
// Paste a value
Clipboard::paste()->title; // 'The new title'
```

#### Clone

[](#clone)

Sometimes you may want to actually *clone* the object instead of copy its reference. For these cases, use the `clone()` method.

```
use Laragear\Clipboard\Facades\Clipboard;
use App\Models\Article;

$article = Article::make(['title' => 'Original title']);

// Clone an object
Clipboard::clone($article);
```

Since it's a clone, the original variable will be different from the one pasted afterward.

```
$article->title = 'Different title';

echo Clipboard::paste()->title; // "Original title"
```

### Cut and pull

[](#cut-and-pull)

Cut works like copy, but the value in the current context will be assigned `null`.

```
use Laragear\Clipboard\Facades\Clipboard;

$article = 'This is a big wall of text.';

// Cut a value
Clipboard::cut($article);

echo $article; // ''
```

Meanwhile, `pull()`, will retrieve the value from the Clipboard and remove it from there. It accepts a default value in case the clipboard is empty.

```
use Laragear\Clipboard\Facades\Clipboard;

$text = Clipboard::pull();

echo $text; // 'This is a big wall of text.'
```

### Clearing

[](#clearing)

You can clear the Clipboard anytime using `clear()`:

```
use Laragear\Clipboard\Facades\Clipboard;

Clipboard::copy('I am going to dissapear.');

Clipboard::clear();

echo Clipboard::paste(); // ''
```

### Method pass-through

[](#method-pass-through)

For your convenience, you don't need to retrieve the Clipboard object to do something. The Clipboard will pass through all methods calls to the copied or cloned object.

```
use Laragear\Clipboard\Facades\Clipboard;
use App\Models\Article;

$article = Article::make(['title' => 'Original title']);

// Copy a value
Clipboard::copy($article);

// Some lines after...
Clipboard::save();
```

How this works?
---------------

[](#how-this-works)

It just registers a singleton that holds a value during the life of the request, or the entirety of the command. That's it.

Laravel Octane compatibility
----------------------------

[](#laravel-octane-compatibility)

- There are no singletons using a stale application instance.
- There are no singletons using a stale config instance.
- There are no singletons using a stale request instance.
- There are no static properties written during a request.

There should be no problems using this package with Laravel Octane.

Security
--------

[](#security)

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

License
=======

[](#license)

This specific package version is licensed under the terms of the [MIT License](LICENSE.md), at time of publishing.

[Laravel](https://laravel.com) is a Trademark of [Taylor Otwell](https://github.com/TaylorOtwell/). Copyright © 2011-2023 Laravel LLC.

Happy April's Fools y'all!
==========================

[](#happy-aprils-fools-yall)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.5% 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 ~0 days

Total

2

Last Release

730d ago

### Community

Maintainers

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

---

Top Contributors

[![DarkGhostHunter](https://avatars.githubusercontent.com/u/5141911?v=4)](https://github.com/DarkGhostHunter "DarkGhostHunter (14 commits)")[![andre-silvakmm](https://avatars.githubusercontent.com/u/74911852?v=4)](https://github.com/andre-silvakmm "andre-silvakmm (2 commits)")

### Embed Badge

![Health badge](/badges/andresilva-clipboard/health.svg)

```
[![Health](https://phpackages.com/badges/andresilva-clipboard/health.svg)](https://phpackages.com/packages/andresilva-clipboard)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M210](/packages/illuminate-pipeline)[laragear/preload

Effortlessly make a Preload script for your Laravel application.

119363.5k](/packages/laragear-preload)[mrmarchone/laravel-auto-crud

Laravel Auto CRUD helps you streamline development and save time.

28711.8k2](/packages/mrmarchone-laravel-auto-crud)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)

PHPackages © 2026

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