PHP code example of kwadwokyeremeh / laravel-package-ide-helper
1. Go to this page and download the library: Download kwadwokyeremeh/laravel-package-ide-helper library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kwadwokyeremeh / laravel-package-ide-helper example snippets
/**
* App\Models\User
*
* @table users
*
* @property int $id (auto-increment)
* @property string $name
* @property \Illuminate\Support\Carbon|string|null $email_verified_at
* @property string|null $settings - User preferences
* @property float $balance (default: 0.00)
*
* @method \Illuminate\Database\Eloquent\Relations\HasMany|Post[] posts()
* @method static \Illuminate\Database\Eloquent\Builder|User query()
*/
class User extends Model { ... }
// lint-config.php
return [
'source_dirs' => ['src', 'lib'],
'exclude' => ['vendor', 'tests', 'node_modules'],
'checks' => [
'general' => true,
'models' => true,
'facades' => true,
'commands' => true,
'providers' => true,
'naming' => true,
'types' => true,
'best_practices' => true,
],
];
return [
'source_dirs' => ['src', 'lib'],
'output' => [
'directory' => '.idea-ide-helper',
'format' => 'php',
],
'generate' => [
'models' => true,
'facades' => true,
'commands' => true,
'providers' => true,
'events' => false,
],
'models' => [
'
namespace YourPackage\Models {
/**
* YourPackage\Models\User
*
* @table users
* @property int $id
* @property string $name
* @property string $email
* @property bool $is_active
* @property \Illuminate\Support\Carbon|string $created_at
* @property \Illuminate\Support\Carbon|string $updated_at
* @method \Illuminate\Database\Eloquent\Relations\HasMany|\Illuminate\Database\Eloquent\Collection|Post[] posts()
* @method static \Illuminate\Database\Eloquent\Builder|User query()
* @method static \Illuminate\Database\Eloquent\Builder|User where($column, $operator = null, $value = null, $boolean = 'and')
* @method static \Illuminate\Database\Eloquent\Builder|User create(array $attributes = [])
*/
class User extends \Illuminate\Database\Eloquent\Model {}
}
namespace YourPackage\Facades {
/**
* Facade: YourPackage\Facades\MyService
* @accessor my-service
*/
class MyService extends \Illuminate\Support\Facades\Facade {}
}
┌─────────────────────────────────────────────────────────────┐
│ Laravel Package Linter │
└─────────────────────────────────────────────────────────────┘
Scanning Package
================
─────────────────────────────────────────────────────────────
Lint Results
─────────────────────────────────────────────────────────────
❌ Errors (2)
src/Models/User.php:15 - Model doesn't define $fillable or $guarded.
This may allow mass assignment vulnerabilities.
💡 Suggestion: Define protected $fillable = [...] or protected $guarded = ['*'];
src/Commands/MyCommand.php:1 - Command is missing $signature property.
💡 Suggestion: Add: protected $signature = 'your:command {argument?} {--option?}';
⚠️ Warnings (3)
src/Models/Post.php:1 - Consider defining $casts property for automatic type conversion.
─────────────────────────────────────────────────────────────
Summary
─────────────────────────────────────────────────────────────
┌─────────────────┬───────┐
│ Metric │ Count │
├─────────────────┼───────┤
│ Files Scanned │ 12 │
│ Total Issues │ 5 │
│ ❌ Errors │ 2 │
│ ⚠️ Warnings │ 3 │
│ ℹ️ Info │ 0 │
│ 💡 Hints │ 0 │
└─────────────────┴───────┘
❌ Found 2 error(s). Please fix them before proceeding.
.idea-ide-helper/
├── _ide_helper.php # Main entry point (elper_facades.php # Facade PHPDoc stubs
├── _ide_helper_commands.php # Command PHPDoc stubs
├── _ide_helper_providers.php # Service provider PHPDoc stubs
└── _ide_helper_events.php # Event PHPDoc stubs (if enabled)
json
{
"php.suggestPaths": [
".idea-ide-helper/_ide_helper.php"
],
"intelephense.files.