Skip to content

Commit

Permalink
packagist
Browse files Browse the repository at this point in the history
  • Loading branch information
ctf0 committed Jun 19, 2017
1 parent 36c35b5 commit d9c5bff
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 17 deletions.
22 changes: 8 additions & 14 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,19 @@ this little package makes things much easier as you dont need to change anything

## Installation

1- copy the file `src/CacheBust.php` to ur project `app/CacheBust.php`.
- `composer require ctf0/asset-cache-bust`

2- from the project root open `composer.json` and add
## Usage

```js
"autoload": {
"files": [
"app/CacheBust.php"
],
- add the service provider to `config/app.php`

// ...
}
```php
'providers' => [
ctf0\AssetCacheBust\AssetCacheBustServiceProvider::class,
]
```

3- run `composer dump-autoload`

## Usage
1- in your view
- in your view

```blade
// before
Expand All @@ -32,4 +27,3 @@ this little package makes things much easier as you dont need to change anything
{{ bustfy('css/style.css') }}
```

**And Thats it** 💃.
28 changes: 28 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "ctf0/asset-cache-bust",
"description": "Automatic Assets CacheBust in Laravel",
"keywords": [
"ctf0",
"AssetCacheBust"
],
"homepage": "https://github.com/ctf0/Asset-Cache-Bust",
"license": "MIT",
"authors": [
{
"name": "Muah",
"email": "[email protected]"
}
],
"require": {
"illuminate/support": "~5.2",
"php" : "~5.6|~7.0"
},
"autoload": {
"psr-4": {
"ctf0\\AssetCacheBust\\": "src"
}
},
"config": {
"sort-packages": true
}
}
23 changes: 23 additions & 0 deletions src/AssetCacheBustServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace ctf0\AssetCacheBust;

use Illuminate\Support\ServiceProvider;

class AssetCacheBustServiceProvider extends ServiceProvider
{
/**
* Perform post-registration booting of services.
*/
public function boot()
{
require_once 'CacheBust.php';
}

/**
* Register any package services.
*/
public function register()
{
}
}
6 changes: 3 additions & 3 deletions src/CacheBust.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

if ( ! function_exists('bustfy')) {
if (!function_exists('bustfy')) {
function bustfy($file, $secure = null)
{
$path = public_path($file);
$path = public_path($file);
$modification_time = filemtime($path);
$render = "{$file}?v={$modification_time}";
$render = "{$file}?v={$modification_time}";

return app('url')->asset($render, $secure);
}
Expand Down

0 comments on commit d9c5bff

Please sign in to comment.