{"id":41194598,"url":"https://github.com/rapidphp/laplus","last_synced_at":"2026-01-22T20:34:55.090Z","repository":{"id":230888129,"uuid":"780377692","full_name":"rapidphp/laplus","owner":"rapidphp","description":"Leave the creation of migrations to Laplus ➕","archived":false,"fork":false,"pushed_at":"2025-04-11T05:13:52.000Z","size":709,"stargazers_count":20,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"4.x","last_synced_at":"2025-12-07T04:20:39.740Z","etag":null,"topics":["database","laravel","migrations"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rapidphp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-01T10:53:33.000Z","updated_at":"2025-10-30T23:32:14.000Z","dependencies_parsed_at":"2024-04-25T17:26:22.350Z","dependency_job_id":"e79d72d1-ca76-4670-b4b3-6f906b4532f6","html_url":"https://github.com/rapidphp/laplus","commit_stats":null,"previous_names":["mahdisaremi/laplus","rapidphp/laplus"],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/rapidphp/laplus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapidphp%2Flaplus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapidphp%2Flaplus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapidphp%2Flaplus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapidphp%2Flaplus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rapidphp","download_url":"https://codeload.github.com/rapidphp/laplus/tar.gz/refs/heads/4.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapidphp%2Flaplus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28670385,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T19:36:09.361Z","status":"ssl_error","status_checked_at":"2026-01-22T19:36:05.567Z","response_time":144,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","laravel","migrations"],"created_at":"2026-01-22T20:34:55.007Z","updated_at":"2026-01-22T20:34:55.070Z","avatar_url":"https://github.com/rapidphp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laplus ➕\nLaravel plus+ add presentation for your models\n\n```php\npublic function present()\n{\n    $this-\u003eid();\n    $this-\u003etext('title');\n    $this-\u003estring('password')-\u003ecast('hashed')-\u003ehidden();\n    $this-\u003ebelongsTo(Artist::class)-\u003ecascadeOnDelete();\n}\n```\n\n## What's Changed In V4\n\n- Command names changed\n- New development \u0026 production deploy tools\n- Removed slug and file columns\n- Supports renames and changes a column at the same time\n- Supports package resources\n- Added travels ([read more...](doc/travel.md))\n- Added validation generators ([read more...](doc/validation.md))\n\n## Features\n\n### 1. Migration Generating\n\nDefine the structure of your model: columns, indexes, data types, enums, relationships,\nor even extensibility with traits.\n\n```php\nclass Blog extends Model\n{\n    use HasPresent;\n    use HasSlug; // Will extend the 'slug' column\n\n    public function present(Present $present)\n    {\n        $present-\u003eid();\n        $present-\u003estring('title');\n        $present-\u003ebelongsTo(Category::class);\n        $present-\u003eenum('status', Status::class);\n        $present-\u003eyield();\n        $present-\u003etimestamps();\n    }\n}\n```\n\nDon't get involved in migrations! Because Laplus has taken responsibility for all migrations,\nand it builds all migrations by reading your presentations 😎\n\n[Read more...](doc/dev.md)\n\n\n### 2. Auto Fills\n\nNo need to redefine \\$fillable, \\$cast and $hidden!\nDefining it in the present specifies everything. So Laplus will autofill these variables. 😉\n\n```php\n// These values will automatically fills:\n// protected $fillable = ['id', 'slug'];\n// protected $cast = ['password' =\u003e 'hashed'];\n// protected $hidden = ['password'];\n```\n\n[Read more...](doc/present.md#fillable)\n\n\n### 3. IDE Friendly\n\nWhen all the columns, their types, and their relationships are known,\nwhy shouldn't the IDE show them to us?\n\nLaplus introduces all of this to the IDE by\ngenerating a neat (and out-of-model) document. 📝\n\n```php\n/**\n * @property int $id\n * @property string $name\n * @property \\App\\Enums\\Gender $gender\n * @method BelongsTo\u003cProfile\u003e profile()\n * @property Profile $profile\n */\n```\n\n[Read more...](doc/guide.md)\n\n\n### 4. Travels\n\nOnce a version of the project has been deployed, it is almost impossible to change the database.\n\nTravels allow you to make changes to the table records as well as change the table structure. ✈️\n\n```php\nreturn new class extends Travel\n{\n    public string|array $on = User::class;\n    public string|array $whenAdded = 'full_name';\n    public string|array $prepareNullable = 'full_name';\n\n    public function up(): void\n    {\n        User::all()-\u003eeach(function (User $user) {\n            $user-\u003eupdate([\n                'full_name' =\u003e $user-\u003efirst_name . ' ' . $user-\u003elast_name,\n            ]);\n        });\n    }\n};\n```\n\nIn the above example, we are going to remove `first_name` and `last_name` from the users table\nand replace them with `full_name`.\n\nThe above class is responsible for generating the `full_name` value using the previous\ndata before deleting `first_name` and `last_name`.\n\n[Read more...](doc/travel.md)\n\n\n## Requirements\n* Php 8.2 or higher\n* Laravel 11.0\n\n\n## Documents\n- [Installation](doc/installation.md)\n- [Configuration](doc/configuration.md)\n- [Present](doc/present.md)\n- [Dev Utils](doc/dev.md)\n- [Deploy](doc/deploy.md)\n- [Label](doc/label.md)\n- [Guide](doc/guide.md)\n- [Travel](doc/travel.md)\n- [Package Development](doc/package-development.md)\n- [Validation Generator](doc/validation.md)\n\n\n## Installation\n### 1- Install the package with composer:\n```shell\ncomposer require rapid/laplus\n```\n\n### 2- Publish configs (Optional)\nRun this command to publish configs to `config/laplus.php`\n```shell\nphp artisan vendor:publish --tag=laplus\n```\n\n### 3- Convert default User model to presentable model (Optional):\n+ Add `HasPresent` trait:\n```php\nclass User extends Model\n{\n    use HasPresent;\n}\n```\n\n+ Remove `$fillable`, `$hidden` and `casts()` values:\n```php\n//protected $fillable = ['name', 'email', 'password'];\n//protected $hidden = ['password', 'remember_token'];\n//protected function casts() { ... }\n```\n\u003e Laplus will automatically add this values.\n\nAdd below code in User class:\n```php\nprotected function present(Present $present)\n{\n    $present-\u003eid();\n    $present-\u003estring('name');\n    $present-\u003estring('email')-\u003eunique();\n    $present-\u003etimestamp('email_verified_at')-\u003enullable();\n    $present-\u003epassword();\n    $present-\u003erememberToken();\n    $present-\u003etimestamps();\n}\n```\n\n+ Move default migration to laplus path:\n\nFind `database/migrations/0001_01_01_000000_create_users_table.php` file and move it\n    into `database/migrations/deploy` folder (create it if doesn't exists)\n\n## Development Utils\n\nTo be able to update your tables during development, you can use the following command:\n\n```shell\nphp artisan dev:migrate --guide\n```\n\n[Read more...](doc/dev.md)\n\n\n## Deployment\n\nWhen deploying the project to production, you can create the final migrations with the following command:\n\n```shell\nphp artisan deploy:migrate\n```\n\n\u003e For greater project safety, you can follow the scenario we have written on the page below.\n\u003e \n[Read more...](doc/deploy.md)\n\n## Make model\nYou can use this command to create a model and a present:\n```shell\nphp artisan make:model-laplus Name\n```\n\nThis command will create `app/Models/Name.php` with inline presentation.\n\n[Read more...](doc/present.md#make-presentable-model)\n\n\n## Make model with separately present\nYou can use this command to create a model with present class:\n```shell\nphp artisan make:model-laplus --present Name\n```\n\nThis command will create `app/Models/Name.php` model and `app/Presents/NamePresent.php` present.\n\n[Read more...](doc/present.md#separately-present)\n\n\n## Migrations\n\n### Generate Migrations\nRun this command to automatically found the updates and generate migrations:\n```shell\nphp artisan dev:migration\n```\n\n[Read more...](doc/dev.md)\n\n### Update Database\nFollowing command, run `dev:migration` and `migrate` at once:\n```shell\nphp artisan dev:migrate\n```\n\n[Read more...](doc/dev)\n\n\n## Label Translator\n\nPresent the model labels:\n\n```php\nclass UserLabelTranslator extends LabelTranslator\n{\n    public function gender(bool $emoji = false)\n    {\n        return $this-\u003evalue?-\u003etoString($emoji); // Returns gender name or null\n    }\n}\n```\n\nAnd use it easily:\n\n```html\n\u003cp\u003e{{ $user-\u003egender_label }}\u003c/p\u003e\n\u003cp\u003e{{ $user-\u003egender_label(emoji: true) }}\u003c/p\u003e\n```\n\n\u003e Labels always return a string value. If the value is null, it returns `\"Undefined\"`.\n\n[Read more...](doc/label.md)\n\n\n## Guide Generator\n\nGuide automatically generate the model docblock using the\ncolumns, attributes and relationships:\n\n```php\nclass User extends Model\n{\n    use HasPresent;\n    use HasLabels;\n    \n    protected function present(Present $present)\n    {\n        $present-\u003eid();\n        $present-\u003estring('name');\n    }\n    \n    #[IsRelation]\n    public function avatars()\n    {\n        return $this-\u003ehasMany(Avatar::class);\n    }\n    \n    public function getFirstName() : string\n    {\n        return Str::before($this-\u003ename, ' ');\n    }\n}\n```\n\nIt generates:\n\n```php\n/**\n * @Guide\n * @property int $id\n * @property string $name\n * @property Collection\u003cint, Avatar\u003e $avatars\n * @property string $name_label\n * @property string name_label()\n * @property string $first_name\n * @EndGuide\n */\nclass User extends Model\n```\n\n[Read more...](doc/guide.md)\n\n\n## More Document\n**More document found in [Documents](#documents) section.**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frapidphp%2Flaplus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frapidphp%2Flaplus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frapidphp%2Flaplus/lists"}