edgrosvenor/php-clipboard

A PHP wrapper for Windows, Linux, and Mac Copy to Clipboard commands

0.3.0 2020-02-25 22:11 UTC

This package is auto-updated.

Last update: 2024-11-26 09:14:15 UTC


README

Latest Version on Packagist StyleCI

This is a 5-minute package I threw togehter that simply wraps the Mac, Windows, and (most common) Linux commands for copying contents to the clipboard. I don't handle reading files. You'll have to do that yourself. I simply pipe whatever contents you provide to the appropriate command based on the operating system reported by php_uname().

Installation

composer require edgrosvenor/php-clipboard

Usage

<?php

use Edgrosvenor\PHPClipboard\Clipboard;

class CopyStuff 
{
    public function copyMyName($name = 'Ed Grosvenor')
    {
        $clipboard = new Clipboard();
        $clipboard->copy($name);
        // 'Ed Grosvenor' has been copied to your clipboard
    }
}