attract/laravel-jodit

An easy way to use the Jodit editor with your Laravel Api service.

1.0.5 2024-07-12 15:33 UTC

This package is auto-updated.

Last update: 2024-09-12 16:13:40 UTC


README

An easy way to use the Jodit editor with your Laravel Api service.

Installation

The package can be installed via composer:

composer require attract/laravel-jodit

Configuration

To configure the package you need to publish settings first:

php artisan vendor:publish --provider="Do6po\LaravelJodit\Providers\JoditServiceProvider" --tag=config

See comments inside the config: config/jodit.php.

S3 configuration

  • Change S3 url in config/filesystems.php to env('APP_URL') . '/storage',
's3' => [
  'driver'     => 's3',
  'key'        => env('AWS_ACCESS_KEY_ID'),
  'secret'     => env('AWS_SECRET_ACCESS_KEY'),
  'region'     => env('AWS_DEFAULT_REGION'),
  'bucket'     => env('AWS_BUCKET'),
  'url'        => env('APP_URL') . '/storage',
  'endpoint'   => env('AWS_ENDPOINT'),
  'visibility' => 'public',
],
  • Create a folder named filebrowser at the root of the bucket.
  • Add permissions to the bucket policy:
{
  "Version": "2012-10-17",
  "Id": "Policy1540386659860",
  "Statement": [
    {
      "Sid": "Stmt1540386655810",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::bucket-name/filebrowser/*"
    }
  ]
}
  • Add permissions to the IAM user policy:
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "s3:ListBucket",
      "Resource": "arn:aws:s3:::bucket-name",
      "Condition": {
        "StringLike": {
          "s3:prefix": "filebrowser/*"
        }
      }
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:PutObject",
        "s3:DeleteObject",
        "s3:PutObjectAcl"
      ],
      "Resource": "arn:aws:s3:::bucket-name/filebrowser/*"
    }
  ]
}

License

The MIT License (MIT). Please see License File for more information.