[
  {
    "path": ".editorconfig",
    "content": "; This file is for unifying the coding style for different editors and IDEs.\n; More information at http://editorconfig.org\n\nroot = true\n\n[*]\ncharset = utf-8\nindent_size = 4\nindent_style = space\nend_of_line = lf\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n\n[*.md]\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": ".gitignore",
    "content": "/node_modules\n/vendor\ncomposer.lock\n.DS_Store\n"
  },
  {
    "path": "LICENSE.md",
    "content": "# The MIT License (MIT)\n\nCopyright (c) 2017 Christoffer Korvald <korvald@gmail.com>\n\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# laravel-emojione <img alt=\"❤️\" width=\"30\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.0/png/128/2764.png\">\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Total Downloads][ico-downloads]][link-downloads]\n[![Software License][ico-license]](LICENSE.md)\n\n<img alt=\"😀\" width=\"50\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.0/png/128/1f600.png\"> <img alt=\"🏋🏼\" width=\"50\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.0/png/128/1f3cb-1f3fc.png\"> <img alt=\"❤️\" width=\"50\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.0/png/128/2764.png\"> <img alt=\"☮\" width=\"50\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.0/png/128/262e.png\">\n\n\nLaravel package to make it easier working with the gorgeous emojis from [EmojiOne](https://emojione.com/). \n\nRemember to read the [EmojiOne Free License](https://www.emojione.com/licenses/free) and provide the appropriate attribution. Or buy a  [premium license](https://www.emojione.com/licenses/premium)\n\n## Upgrading from 3.x to 4.x\n\n1. Update your composer dependency to: `\"christofferok/laravel-emojione\": \"^4.0\"` and run `composer update`\n2. Update `config/emojione.php` (if you have one) with `'emojiVersion' => '4.0'`\n\nIf you are serving the assets yourself then you need to do the following things:\n\n1. Update your emojione/assets composer dependency to: `\"emojione/assets\": \"^4.0\"` and run `composer update`\n2. Update `config/emojione.php` with the correct paths and versions\n3. Publish the assets again. See \"Assets\" section further down\n\n## EmojiOne 4.x/3.x vs 2.0\nEmojiOne made a lot of changes in their licensing and which resources are provided in the free license. v2 code is still available in the [emojione-v2](https://github.com/christofferok/laravel-emojione/tree/emojione-v2) branch. If you are upgrading this package, be aware that the SVG assets are not available anymore. \n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require christofferok/laravel-emojione\n```\n__If you are on Laravel 5.4 or lower you need to add the following to your `config/app.php` file:__\n\nAdd the ServiceProvider to the providers array in `config/app.php`\n\n``` php\nChristofferOK\\LaravelEmojiOne\\LaravelEmojiOneServiceProvider::class,\n```\n\nAdd this to the aliases array in `config/app.php`\n\n``` php\n'LaravelEmojiOne' => ChristofferOK\\LaravelEmojiOne\\LaravelEmojiOneFacade::class,\n```\n\nConfig:\n\n``` bash\n$ php artisan vendor:publish --tag=config --provider=\"ChristofferOK\\LaravelEmojiOne\\LaravelEmojiOneServiceProvider\"\n```\n\n## Usage\n\n``` php\nLaravelEmojiOne::toShort($str); // - native unicode -> shortnames\nLaravelEmojiOne::shortnameToImage($str); // - shortname -> images\nLaravelEmojiOne::unicodeToImage($str); // - native unicode -> images\nLaravelEmojiOne::toImage($str); // - native unicode + shortnames -> images (mixed input)\n```\n\nBlade (equivalent to `LaravelEmojiOne::toImage($str)`): \n\n`@emojione(':smile:')` -> <img alt=\"😀\" width=\"20\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.0/png/64/1f600.png\">\n\n`@emojione(':smile: ❤️')` -> <img alt=\"😀\" width=\"20\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.0/png/128/1f600.png\"><img alt=\"❤️\" width=\"20\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.0/png/128/2764.png\">\n\n🚨 The output is not escaped so be careful with what you pass into `@emojione`.\n\nMore details about how `toImage($str)` works can be found at [https://github.com/Ranks/emojione/blob/master/examples/PHP.md](https://github.com/Ranks/emojione/blob/master/examples/PHP.md)\n\n### Example\nYou want to let users put emoji a comment. \nWhen you are saving a comment, you might want to run the content through `LaravelEmojiOne::toShort($str)` to convert `😄` and other emoji to `:smile:` etc. \n\n```php\nComment::create([\n  'content' => LaravelEmojiOne::toShort(request('content'))\n]);\n```\nSo if someone leaves a comment like `This is an awesome comment 😄🔥` it will be saved as `This is an awesome comment :smile: :fire:`\n\nIn your view where you display your comments you can use \n\n```php\n@emojione($comment->content)\n```\nand that will convert `:smile:` and `😄` to the emojione equivalent. \n\n\n## Assets\nBy default it will use the assets from JSDelivr.\n\nRemember to run this before trying to publish any of the assets:\n\n```bash\ncomposer require emojione/assets\n```\n\nIf you want to serve the assets yourself you can publish them with the following commands. Remember to update `config/emojione.php`\n\nPNG files in sizes 32/64/128:\n\n``` bash\n$ php artisan vendor:publish --tag=public --provider=\"ChristofferOK\\LaravelEmojiOne\\LaravelEmojiOneServiceProvider\"\n```\n\nIn `config/emojione.php` specify the local path. Remember to specify which size you want in the path (32/64/128). \n\n```php\n'imagePathPNG' => '/vendor/emojione/png/64/',\n```\n\n### Sprites\nIf you want to use sprites:\n\n``` bash\n$ php artisan vendor:publish --tag=sprites --provider=\"ChristofferOK\\LaravelEmojiOne\\LaravelEmojiOneServiceProvider\"\n```\n\nIn `config/emojione.php` enable sprites:\n\n```php\n'sprites' => true,\n'spriteSize' => 32, // 32 or 64\n```\n\nAdd the stylesheet to your HTML:\n\n```html\n<link rel=\"stylesheet\" href=\"/vendor/emojione/sprites/emojione-sprite-{{ config('emojione.spriteSize') }}.min.css\"/>\n```\n\n\n## License\n\nRemember to read the [EmojiOne Free License](https://www.emojione.com/developers/free-license) and provide the appropriate attribution. Or buy a  [premium license](https://www.emojione.com/developers/premium-license)\n\n[ico-version]: https://img.shields.io/packagist/v/christofferok/laravel-emojione.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-travis]: https://img.shields.io/travis/christofferok/laravel-emojione/master.svg?style=flat-square\n[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/christofferok/laravel-emojione.svg?style=flat-square\n[ico-code-quality]: https://img.shields.io/scrutinizer/g/christofferok/laravel-emojione.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/christofferok/laravel-emojione.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/christofferok/laravel-emojione\n[link-travis]: https://travis-ci.org/christofferok/laravel-emojione\n[link-scrutinizer]: https://scrutinizer-ci.com/g/christofferok/laravel-emojione/code-structure\n[link-code-quality]: https://scrutinizer-ci.com/g/christofferok/laravel-emojione\n[link-downloads]: https://packagist.org/packages/christofferok/laravel-emojione\n[link-author]: https://github.com/christofferok\n"
  },
  {
    "path": "composer.json",
    "content": "{\n    \"name\": \"christofferok/laravel-emojione\",\n    \"type\": \"library\",\n    \"description\": \"Laravel helper for EmojiOne\",\n    \"keywords\": [\n        \"ChristofferOK\",\n        \"LaravelEmojiOne\",\n        \"laravel\",\n        \"emoji\",\n        \"emojione\"\n    ],\n    \"homepage\": \"https://github.com/christofferok/LaravelEmojiOne\",\n    \"license\": \"MIT\",\n    \"authors\": [\n        {\n            \"name\": \":Christoffer Korvald\",\n            \"email\": \"korvald@gmail.com\",\n            \"homepage\": \"https://christofferok.com\",\n            \"role\": \"Developer\"\n        }\n    ],\n    \"require\": {\n        \"php\": \"~5.6|~7.0|~8.0\",\n        \"emojione/emojione\": \"^4.0.0\",\n        \"illuminate/support\": \"~5.1|~6.0|~7.0|~8.0|~9.0\"\n    },\n    \"suggest\": {\n        \"emojione/assets\": \"If you want to serve the emojione assets yourself\"\n    },\n    \"require-dev\": {\n        \"phpunit/phpunit\": \"~4.0|~5.0\",\n        \"squizlabs/php_codesniffer\": \"^2.3\"\n    },\n    \"autoload\": {\n        \"psr-4\": {\n            \"ChristofferOK\\\\LaravelEmojiOne\\\\\": \"src\"\n        }\n    },\n    \"autoload-dev\": {\n        \"psr-4\": {\n            \"ChristofferOK\\\\LaravelEmojiOne\\\\\": \"tests\"\n        }\n    },\n    \"scripts\": {},\n    \"extra\": {\n        \"laravel\": {\n            \"providers\": [\n                \"ChristofferOK\\\\LaravelEmojiOne\\\\LaravelEmojiOneServiceProvider\"\n            ],\n            \"aliases\": {\n                \"LaravelEmojiOne\": \"ChristofferOK\\\\LaravelEmojiOne\\\\LaravelEmojiOneFacade\"\n            }\n        }\n    },\n    \"config\": {\n        \"sort-packages\": true\n    }\n}\n"
  },
  {
    "path": "config/emojione.php",
    "content": "<?php\nreturn [\n    'imagePathPNG' => null, // defaults to jsdelivr's free CDN\n    'sprites' => false, // use sprites?\n    'spriteSize' => 32, // 32/64\n\n    // If you are using the cdn, then you can change these values to get different sizes\n    'emojiSize' => 64, // 32/64/128\n    'emojiVersion' => '4.0',\n    \n    'ascii' => false, // convert ascii characters into emoji shortcodes\n];\n"
  },
  {
    "path": "src/LaravelEmojiOne.php",
    "content": "<?php\n\nnamespace ChristofferOK\\LaravelEmojiOne;\n\nuse Emojione\\Client;\nuse Emojione\\Ruleset;\n\nclass LaravelEmojiOne\n{\n    private $client;\n\n    public function __construct()\n    {\n        $this->client = new Client(new Ruleset());\n\n        $this->client->emojiSize = config('emojione.emojiSize');\n        $this->client->sprites = config('emojione.sprites');\n        $this->client->spriteSize = config('emojione.spriteSize');\n        $this->client->emojiVersion = config('emojione.emojiVersion');\n\n        if (config('emojione.imagePathPNG')) {\n            $this->client->imagePathPNG = url(config('emojione.imagePathPNG')) . '/';\n        }\n        else {\n            // Use the CDN if 'imagePathPNG' config is not set\n            $this->client->imagePathPNG = 'https://cdn.jsdelivr.net/emojione/assets' . '/' . $this->client->emojiVersion . '/png/' . $this->client->emojiSize . '/';\n        }\n        \n        // config ascii option added ternary incase option isn't part of config \n        $this->client->ascii = config('emojione.ascii') ? true : false;\n        \n    }\n\n    public function toImage($str)\n    {\n        return $this->client->toImage($str);\n    }\n\n    public function toShort($str)\n    {\n        return $this->client->toShort($str);\n    }\n\n    public function shortnameToImage($str)\n    {\n        return $this->client->shortnameToImage($str);\n    }\n\n    public function unicodeToImage($str)\n    {\n        return $this->client->unicodeToImage($str);\n    }\n\n    public function getClient()\n    {\n        return $this->client;\n    }\n}\n"
  },
  {
    "path": "src/LaravelEmojiOneFacade.php",
    "content": "<?php\nnamespace ChristofferOK\\LaravelEmojiOne;\n\nuse Illuminate\\Support\\Facades\\Facade;\n\nclass LaravelEmojiOneFacade extends Facade\n{\n    protected static function getFacadeAccessor()\n    {\n        return LaravelEmojiOne::class;\n    }\n}\n"
  },
  {
    "path": "src/LaravelEmojiOneServiceProvider.php",
    "content": "<?php\n\nnamespace ChristofferOK\\LaravelEmojiOne;\n\nuse Illuminate\\Contracts\\Container\\Container;\nuse Illuminate\\Support\\ServiceProvider;\n\nclass LaravelEmojiOneServiceProvider extends ServiceProvider\n{\n\n    public function boot()\n    {\n        $this->publishes([__DIR__.'/../config/emojione.php' => config_path('emojione.php')], 'config');\n\n        $this->publishes([\n            base_path('vendor/emojione/assets/png') => public_path('vendor/emojione/png'),\n        ], 'public');\n\n        $this->publishes([\n            base_path('vendor/emojione/assets/sprites') => public_path('vendor/emojione/sprites'),\n        ], 'sprites');\n\n        \\Blade::directive('emojione', function ($expression) {\n            return \"<?php echo \\App::make('\".LaravelEmojiOne::class.\"')->toImage($expression); ?>\";\n        });\n    }\n\n    public function register()\n    {\n        $this->mergeConfigFrom(__DIR__.'/../config/emojione.php', 'emojione');\n        $this->app->singleton(LaravelEmojiOne::class, function (Container $app) {\n            return new LaravelEmojiOne();\n        });\n    }\n}\n"
  }
]