https://github.com/codeinwp/optimole-laravel
https://github.com/codeinwp/optimole-laravel
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/codeinwp/optimole-laravel
- Owner: Codeinwp
- License: other
- Created: 2024-06-07T07:24:59.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-27T19:03:04.000Z (over 1 year ago)
- Last Synced: 2025-07-08T15:59:27.133Z (7 months ago)
- Language: PHP
- Size: 7.81 KB
- Stars: 3
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Optimole Laravel Package
[](https://github.com/Codeinwp/optimole-laravel/actions)
## Requirements
* Laravel >= 9.0
## Installation
Install the Optimole Laravel Package in your project using composer:
```
$ composer require codeinwp/optimole-laravel
```
If you want, you can publish Optimole's configuration file using the `vendor:publish` command:
```
$ php artisan vendor:publish --tag="optimole-config"
```
## Configuration
The Optimole package will remain inactive until you provide an Optimole API key. You can do this by adding the
`OPTIMOLE_KEY` variable to your `.env` file:
```
OPTIMOLE_KEY=your-optmole-api-key
```
If you don't have an API key, you can create an account on [Optimole][1] and get your API key.
## Usage
By default, the Optimole Laravel Package will optimize all images and assets in your Laravel application if they use
the [`asset`][2] helper function. The package also provides two helper functions that you can use in your blade
templates. The `optimole_asset` function will return the URL of the optimized CSS or JS files, while the
`optimole_image` function will return the URL of the optimized image.
[1]: https://optimole.com
[2]: https://laravel.com/docs/master/helpers#method-asset