From 7ef2d2f39846df7fb516a81cc6802ef104c97076 Mon Sep 17 00:00:00 2001 From: Nikos Gr Date: Wed, 25 Mar 2015 21:56:47 +0200 Subject: [PATCH] update readme.md --- readme.md | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/readme.md b/readme.md index 5604445..a740e57 100644 --- a/readme.md +++ b/readme.md @@ -7,8 +7,8 @@ _Checkout [this Laracasts video](https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/15) for a quick introduction/explanation!_ -This packages generates a file that your IDE can understand, so it can provide accurate autocompletion. Generation is done, based on the files in your project, so they are alway up-to-date. -If you don't want to generate it, you can add a pre-generated file to the root folder of your laravel project. (But this isn't as up-to-date as self generated files) +This package generates a file that your IDE understands, so it can provide accurate autocompletion. Generation is done based on the files in your project, so they are always up-to-date. +If you don't want to generate it, you can add a pre-generated file to the root folder of your Laravel project (but this isn't as up-to-date as self generated files). * Generated version: https://gist.github.com/barryvdh/5227822 @@ -16,20 +16,20 @@ Note: You do need CodeIntel for Sublime Text: https://github.com/SublimeCodeInte ### New: PhpStorm Meta for Container instances -It's possible to generate a PhpStorm meta file, to [add support for factory design pattern](https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata). For Laravel, this means we can make PhpStorm understand what kind of object we are resolving from the IoC Container. For example, `events` will return ann `Illuminate\Events\Dispatcher` object, so with the meta file you can call `app('events')` and it will autocomplete the Dispatcher methods. +It's possible to generate a PhpStorm meta file, to [add support for factory design pattern](https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata). For Laravel, this means we can make PhpStorm understand what kind of object we are resolving from the IoC Container. For example, `events` will return an `Illuminate\Events\Dispatcher` object, so with the meta file you can call `app('events')` and it will autocomplete the Dispatcher methods. php artisan ide-helper:meta - + app('events')->fire(); \App::make('events')->fire(); - + /** @var \Illuminate\Foundation\Application $app */ $app->make('events')->fire(); -Pre-generated example: https://gist.github.com/barryvdh/bb6ffc5d11e0a75dba67 +Pre-generated example: https://gist.github.com/barryvdh/bb6ffc5d11e0a75dba67 > Note: You might need to restart PhpStorm and make sure `.phpstorm.meta.php` is indexed. -> Note: When you receive a FatalException about a class that is not found, check your config (For example, remove S3 as cloud driver when you don't have S3 configured. Remove Redis ServiceProvider when you don't use it.) +> Note: When you receive a FatalException about a class that is not found, check your config (for example, remove S3 as cloud driver when you don't have S3 configured. Remove Redis ServiceProvider when you don't use it). ### Automatic phpDoc generation for Laravel Facades @@ -37,47 +37,47 @@ Require this package with composer using the following command: composer require barryvdh/laravel-ide-helper -After updating composer, add the ServiceProvider to the providers array in config/app.php +After updating composer, add the service provider to the `providers` array in `config/app.php` 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider', -You can now re-generate the docs yourself (for future updates) in artisan +You can now re-generate the docs yourself (for future updates) php artisan ide-helper:generate -Note: bootstrap/compiled.php has to be cleared first, so run `php artisan clear-compiled` before generating (and `php artisan optimize` after..) +Note: `bootstrap/compiled.php` has to be cleared first, so run `php artisan clear-compiled` before generating (and `php artisan optimize` after). You can configure your composer.json to do this after each commit: "scripts":{ - "post-update-cmd":[ + "post-update-cmd": [ "php artisan clear-compiled", "php artisan ide-helper:generate", "php artisan optimize" ] }, -You can also publish the config-file to change implementations (ie. interface to specific class) or set defaults for --helpers or --sublime. +You can also publish the config file to change implementations (ie. interface to specific class) or set defaults for `--helpers` or `--sublime`. php artisan vendor:publish --provider=barryvdh/laravel-ide-helper --tag=config The generator tries to identify the real class, but if it cannot be found, you can define it in the config file. -Some classes need a working database connection. If you do not have a working default connection, some facades will not be included. -You can use a in-memory sqlite driver, using the -M option. +Some classes need a working database connection. If you do not have a default working connection, some facades will not be included. +You can use an in-memory SQLite driver, using the -M option. -You can choose to include helper files. This is not enabled by default, but you can override this with the --helpers (-H) option. -The Illuminate/Support/helpers.php is already set-up, but you can add/remove your own files in the config file. +You can choose to include helper files. This is not enabled by default, but you can override it with the `--helpers (-H)` option. +The `Illuminate/Support/helpers.php` is already set-up, but you can add/remove your own files in the config file. -### Automatic phpDocs for Models +### Automatic phpDocs for models -> You need to require `doctrine/dbal: ~2.3` in your own composer.json to get database columns. +> You need to require `doctrine/dbal: ~2.3` in your own composer.json to get database columns. -If you don't want to write your properties yourself, you can use the command `ide-helper:models` to generate -phpDocs, based on table columns, relations and getters/setters. You can write the comments directly to your Model file, using the `--write (-W)` option. By default, you are asked to overwrite or write to a separate file (\_ide\_helper\_models.php) (You can force No with `--nowrite (-N)`). +If you don't want to write your properties yourself, you can use the command `php artisan ide-helper:models` to generate +phpDocs, based on table columns, relations and getters/setters. You can write the comments directly to your Model file, using the `--write (-W)` option. By default, you are asked to overwrite or write to a separate file (`_ide_helper_models.php`). You can force No with `--nowrite (-N)`. Please make sure to backup your models, before writing the info. It should keep the existing comments and only append new properties/methods. The existing phpdoc is replaced, or added if not found. -With the `--reset (-R)` option, the existing phpdocs are ignored, only the newly found columns/relations are saved as phpdocs. +With the `--reset (-R)` option, the existing phpdocs are ignored, and only the newly found columns/relations are saved as phpdocs. php artisan ide-helper:models Post @@ -94,17 +94,17 @@ With the `--reset (-R)` option, the existing phpdocs are ignored, only the newly * @property-read \Illuminate\Database\Eloquent\Collection|\Comment[] $comments */ -By default, models in app/models are scanned. The optional argument tells what models to use (also outside app/models). +By default, models in `app/models` are scanned. The optional argument tells what models to use (also outside app/models). php artisan ide-helper:models Post User -You can also scan a different directory, using the --dir option (relative from the base path): +You can also scan a different directory, using the `--dir` option (relative from the base path): php artisan ide-helper:models --dir="path/to/models" --dir="app/src/Model" - + You can publish the config file (`php artisan vendor:publish`) and set the default directories. -Models can be ignored using the --ignore (-I) option +Models can be ignored using the `--ignore (-I)` option php artisan ide-helper:models --ignore="Post,User"