Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| Collection::macro('transpose', function () { | |
| $items = array_map(function (...$items) { | |
| return $items; | |
| }, ...$this->values()); | |
| return new static($items); | |
| }); | |
| public function store(Request $request) | |
| { |
| <?php | |
| namespace App\Providers; | |
| use Illuminate\Routing\Router; | |
| use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; | |
| class RouteServiceProvider extends ServiceProvider | |
| { | |
| /** |
| How to configure phpStorm with EditorConfig and PHPMD: | |
| ----------------------------------------------------- | |
| PHPMD: | |
| ------ | |
| phpmd (PHP Mess Detector) is a static analysis tool that will find issues in your code you never knew you had. Your code will still run, follow a few of phpmd's recommendations though and it will be better! | |
| phpmd is already bundled and enabled in phpstorm, but in order to more easily manage versions and add custom rulesets, you should do the following: |
| <?php | |
| class AppServiceProvider extends ServiceProvider | |
| { | |
| /** | |
| * Bootstrap any application services. | |
| * | |
| * @return void | |
| */ | |
| public function boot() |
| <IfModule mod_rewrite.c> | |
| RewriteEngine on | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteRule wp-content/uploads/(.*) http://PRODUCTION_SERVER/wp-content/uploads/$1 [NC,L] | |
| </IfModule> |
| { | |
| "shell_cmd": "php \"${file}\"", | |
| "working_dir": "${file_path}", | |
| "selector": "source.php" | |
| } |
| <?php | |
| /** | |
| * Return the value for a key in an array or a property in an object. | |
| * Typical usage: | |
| * | |
| * $object->foo = 'Bar'; | |
| * echo get_key($object, 'foo'); | |
| * | |
| * $array['baz'] = 'Bat'; | |
| * echo get_key($array, 'baz'); |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.