{"id":18353001,"url":"https://github.com/thecodeholic/yii2-grapesjs","last_synced_at":"2025-08-23T22:05:37.698Z","repository":{"id":57067816,"uuid":"205526250","full_name":"thecodeholic/yii2-grapesjs","owner":"thecodeholic","description":"Yii2 GrapesJs AssetBundle, Actions and module","archived":false,"fork":false,"pushed_at":"2024-02-08T17:19:19.000Z","size":2023,"stargazers_count":6,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-17T21:24:15.101Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thecodeholic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-08-31T09:51:11.000Z","updated_at":"2025-04-18T05:38:34.000Z","dependencies_parsed_at":"2024-11-05T21:52:44.244Z","dependency_job_id":null,"html_url":"https://github.com/thecodeholic/yii2-grapesjs","commit_stats":{"total_commits":33,"total_committers":1,"mean_commits":33.0,"dds":0.0,"last_synced_commit":"cf22761b5d54561b12203fb02ea9bb6fca3c649d"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/thecodeholic/yii2-grapesjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodeholic%2Fyii2-grapesjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodeholic%2Fyii2-grapesjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodeholic%2Fyii2-grapesjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodeholic%2Fyii2-grapesjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecodeholic","download_url":"https://codeload.github.com/thecodeholic/yii2-grapesjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodeholic%2Fyii2-grapesjs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262182711,"owners_count":23271671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-05T21:38:08.276Z","updated_at":"2025-06-27T03:36:26.090Z","avatar_url":"https://github.com/thecodeholic.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Grapesjs AssetBundle and widgets\n================================\nGrapesjs AssetBundle, widgets and module\n\nInstallation\n------------\n\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```\nphp composer.phar require --prefer-dist thecodeholic/yii2-grapesjs \"^v0.1.0\"\n```\n\nor add\n\n```\n\"thecodeholic/yii2-grapesjs\": \"^v0.1.0\"\n```\n\nto the require section of your `composer.json` file.\n\n\nConfiguration\n-----\n\nOnce the module is installed, you need to run migrations:\n\n```php\nphp yii migrate --migrationPath=@vendor/thecodeholic/yii2-grapesjs/migrations\n```\n\nAnd add module in your config `modules`\n\n```php\n'modules' =\u003e [\n    'grapesjs' =\u003e [\n        'class' =\u003e \\thecodeholic\\yii2grapesjs\\Module::class,\n        // custom placeholder variables which will be added into richtext\n        // default is empty array\n        'grapesJsVariables' =\u003e [\n            '{first_name}' =\u003e 'First Name',\n            '{last_name}' =\u003e 'Last Name',\n            '{age}' =\u003e 'Age',\n        ]\n    ],\n    ...\n]\n```\n\nConfiguring AssetManager\n------------------------\nThe package uses `Yii::$app-\u003efs` so you need to configure `fs` component to be one of the available \ntargets of `creocoder\\flysystem`\n\nCheckout its documentation if you want to specify different targets\nhttps://github.com/creocoder/yii2-flysystem\n\nAnd you need to install your desired target.\n\nFor example\n```php\ncomposer require creocoder/yii2-flysystem\n```\n\nUsing the widget in your own controller\n---------------------------------------\nIf you do not want to use the module and integrate in your controller, you should add `JsonParser` in request parser's.\n\n```php\n'request' =\u003e [\n    'parsers' =\u003e [\n        'application/json' =\u003e 'yii\\web\\JsonParser',\n    ]\n]\n```\n\nDisplay the widget in your view file.\n\n```php\n\u003c?php echo \\thecodeholic\\yii2grapesjs\\widgets\\GrapesjsWidget::widget([\n    'clientOptions' =\u003e [\n        'storageManager' =\u003e [\n            'id' =\u003e '',\n            'type' =\u003e 'remote',\n            'stepsBeforeSave' =\u003e 1,\n            'urlStore' =\u003e \"save?id=$model-\u003eid\",\n            'urlLoad' =\u003e \"get?id=$model-\u003eid\",\n        ],\n        'assetManager' =\u003e [\n            'upload' =\u003e \"upload\"\n        ],\n        'deviceManager' =\u003e [\n            'defaultDevice' =\u003e 'Resolution 2',\n            'devices' =\u003e [\n                [\n                    'name' =\u003e 'Resolution 1',\n                    'width' =\u003e '850px',\n                    'widthMedia' =\u003e '992px'\n                ],\n                [\n                    'name' =\u003e 'Resolution 2',\n                    'width' =\u003e '750px',\n                ],\n                [\n                    'name' =\u003e 'Resolution 3',\n                    'width' =\u003e '650px'\n                ],\n                [\n                    'name' =\u003e 'Resolution 4',\n                    'width' =\u003e '450px',\n                ],\n                [\n                    'name' =\u003e 'Resolution 5',\n                    'width' =\u003e '375px',\n                ]\n            ]\n        ]\n    ],\n    // custom placeholder variables which will be added into richtext\n    // default is empty array\n    'variables' =\u003e [\n        '{first_name}' =\u003e 'First Name',\n        '{last_name}' =\u003e 'Last Name',\n        '{age}' =\u003e 'Age',\n    ]\n]) ?\u003e\n```\n\nAdd the following actions to your controller.\n\n```php\npublic function actions()\n{\n    return array_merge(parent::actions(), [\n        'get' =\u003e [\n            'class' =\u003e \\thecodeholic\\yii2grapesjs\\actions\\GetAction::class,\n            // If includeFields is presented `excludeFields` are not considered\n            // 'includeFields' =\u003e ['css', 'html'],\n            // Exclude assets column from returned fields of the Content model\n            'excludeFields' =\u003e ['assets']\n        ],\n        'save' =\u003e \\thecodeholic\\yii2grapesjs\\actions\\SaveAction::class,\n        'upload' =\u003e \\thecodeholic\\yii2grapesjs\\actions\\UploadAction::class\n    ]);\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodeholic%2Fyii2-grapesjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodeholic%2Fyii2-grapesjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodeholic%2Fyii2-grapesjs/lists"}