Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
m1guelpf committed May 14, 2020
0 parents commit 1f97b64
Show file tree
Hide file tree
Showing 9 changed files with 199 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at https://editorconfig.org

root = true

[*]
charset = utf-8
indent_size = 4
indent_style = tab
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
13 changes: 13 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.php.cs export-ignore
/.github export-ignore

1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: m1guelpf
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
build
composer.lock
docs
vendor
coverage
.phpunit.result.cache
.idea
.php_cs.cache

21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) Miguel Piedrafita <soy@miguelpiedrafita.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Laravel Fun :sparkles:

[![Latest Version on Packagist](https://img.shields.io/packagist/v/m1guelpf/laravel-fun.svg?style=flat-square)](https://packagist.org/packages/m1guelpf/laravel-fun)
[![Total Downloads](https://img.shields.io/packagist/dt/m1guelpf/laravel-fun.svg?style=flat-square)](https://packagist.org/packages/m1guelpf/laravel-fun)

A fun package that registers a few routes bots usually search for, and gives them a nice surprise instead. Inspired by [this tweet](https://twitter.com/LiamHammett/status/1260984553570570240).

## Installation

You can install the package via composer:

```bash
composer require m1guelpf/laravel-fun
```

## Usage

Just enjoy!

## Contributing

You can add more paths or redirects by editing the `FunServiceProvider` file!

## Credits

- [Miguel Piedrafita](https://twitter.com/m1guelpf)
- [Lian Hammett](https://twitter.com/LiamHammett)
- [All Contributors](../../contributors)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
42 changes: 42 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "m1guelpf/laravel-fun",
"description": ":package_description",
"keywords": [
"m1guelpf",
"laravel-fun",
"laravel"
],
"homepage": "https://github.com/m1guelpf/laravel-fun",
"license": "MIT",
"authors": [
{
"name": "Miguel Piedrafita",
"email": "soy@miguelpiedrafita.com",
"homepage": "https://miguelpiedrafita.com",
"role": "Developer"
}
],
"require": {
"php": "^7.4",
"illuminate/http": "^7.11",
"illuminate/routing": "^7.11",
"illuminate/support": "^7.11"
},
"autoload": {
"psr-4": {
"M1guelpf\\Fun\\": "src"
}
},
"config": {
"sort-packages": true
},
"extra": {
"laravel": {
"providers": [
"M1guelpf\\Fun\\FunServiceProvider"
]
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
49 changes: 49 additions & 0 deletions src/FunServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace M1guelpf\Fun;

use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
use M1guelpf\Fun\Http\FunController;

class FunServiceProvider extends ServiceProvider
{
const PATHS = [
'.env',
'wp-login.php',
'wp-admin',
'admin.php',
'xmlrpc.php',
'admin',
];

const FUN = [
'https://www.youtube.com/watch?v=wbby9coDRCk',
'https://www.youtube.com/watch?v=nb2evY0kmpQ',
'https://www.youtube.com/watch?v=eh7lp9umG2I',
'https://www.youtube.com/watch?v=z9Uz1icjwrM',
'https://www.youtube.com/watch?v=Sagg08DrO5U',
'https://www.youtube.com/watch?v=5XmjJvJTyx0',
'https://www.youtube.com/watch?v=IkdmOVejUlI',
'https://www.youtube.com/watch?v=jScuYd3_xdQ',
'https://www.youtube.com/watch?v=S5PvBzDlZGs',
'https://www.youtube.com/watch?v=9UZbGgXvCCA',
'https://www.youtube.com/watch?v=O-dNDXUt1fg',
'https://www.youtube.com/watch?v=MJ5JEhDy8nE',
'https://www.youtube.com/watch?v=VnnWp_akOrE',
'https://www.youtube.com/watch?v=jwGfwbsF4c4',
'https://www.youtube.com/watch?v=8ZcmTl_1ER8',
'https://www.youtube.com/watch?v=gLmcGkvJ-e0',
'https://www.youtube.com/watch?v=hGlyFc79BUE',
'https://www.youtube.com/watch?v=xA8-6X8aR3o',
'https://www.youtube.com/watch?v=7R1nRxcICeE',
'https://www.youtube.com/watch?v=sCNrK-n68CM',
];

public function boot()
{
collect(static::PATHS)
->reject(fn ($path) => Route::exists($path))
->each(fn ($path) => Route::redirect($path, FunController::class));
}
}
14 changes: 14 additions & 0 deletions src/Http/FunController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace M1guelpf\Fun\Http;

use Illuminate\Support\Facades\Response;
use M1guelpf\Fun\FunServiceProvider;

class FunController
{
public function __invoke()
{
return Response::redirectTo(collect(FunServiceProvider::FUN)->random());
}
}

0 comments on commit 1f97b64

Please sign in to comment.