transloadit / php-sdk

Transloadit's official PHP SDK

Home Page:https://transloadit.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

proposal for new major

eerison opened this issue Β· comments

Hi I'm here again :)

I would like to know if make sense to create a new release change all structure

  • use PSR4
  • create Models and Services
  • use symfony/http-client for requests
  • use symfony/serializer to converte object to json
  • use github actions (it`s optional, but should be good use only GitHub features)
  • use twig/twig template engine to form (It's not really clear why do we need this)
  • create a new doc
  • create tests
  • add coverage
  • add phpcs
  • create pipeline to generate release

Questions

  • I saw some examples using Jquery, make sense we keep this in php-sdk?
  • Why do we need this assemblyForm
    public function createAssemblyForm($options = array()) {
  • Can we support just php version ^7.2 (>=7.2)?

Fixes: #30 #31 #32

Hey there,

The form is useful to generate the form for the backend. Regard it as a View helper.

The rest of your list sounds like music in my ears! Would you want to give it a try?

Ok it's fine

I'll use twig template engine for this then

Could you create a branch 3.x and all new PR you merge to this branch?

Because the new major will be merge to Master like other famus repository

Symfony, laravel, sonata and so on

Please don't merge any new PR to master only to 3.x

Hey there,

The form is useful to generate the form for the backend. Regard it as a View helper.

The rest of your list sounds like music in my ears! Would you want to give it a try?

Hey @tim-kos this first MR I'll be change the structure, tests and creating few examples

After that I'll do new PRs

  • using github action
  • adding coverage, phpcs and phpmd
  • documentation

Just this first PR will be huge but the others Will be fine to review

Nice! What about swapping the jquery sdk out for Uppy? We are slowly deprecating the former in favor of the latter

Nice! What about swapping the jquery sdk out for Uppy? We are slowly deprecating the former in favor of the latter

Hey @kvz

I didn't see this jQuery sdk but I guess make sense, but my idea is removing this jQuery example or js example for next major

Time to time I'm working in this new release 😊

Awesome, @eerison !

Indeed swapping out the jQuery SDK (EOL for a long time) for Uppy would be ✨ .

Hey @tim-kos and @kvz happy new year πŸŽ‰

I've tried to create an assembly this way

Request

POST https://api2.transloadit.com/assemblies
Content-Type: application/json
Accept: application/json

{
   "signature":"my_signature",
   "params":{
      "auth":{
         "key":"my_key",
         "expires":"2021/01/21 21:51:27+00:00"
      },
      "template_id":"my_template_id",
      "steps":{
         "screenshot_en":{
            "url":"https://www.google.com"
         },
         "screenshot_pt_BR":{
            "url":"https://www.google.com"
         },
         "store":{
            "credentials":"credentials-staging",
            "url_prefix":"https://localhost",
            "path":"users/87146c666b89aa4ee951d45a13f8074d/curriculum/${file.name}"
         }
      }
   }
}

Response

{
  "error": "INVALID_PARAMS_FIELD",
  "message": "Bad params field provided, it contains invalid json.",
  "http_code": 400
}

But I'm getting this error, what am I doing wrong πŸ˜„

it works doing the request this way

       $response = $this->client->request(
            self::HTTP_METHOD_POST,
            $url,
            [
                'multipart' => [
                    [
                        'name' => 'signature',
                        'contents' => $signature,
                    ],
                    [
                        'name' => 'params',
                        'contents' => $params, #json
                    ]
                ]
            ]
        );

How is $params constructed? For PHP:

If you use PHP for example, please check the JSON_UNESCAPED_SLASHES option of the json_encode function.

From https://transloadit.com/docs/#example-code-for-different-languages

Also, from the first representation of the request I cannot determine it is a multipart request where all this lives in the transloadit field, correct?

Hi @kvz you can ignore this comment above.

you can see how this body was mounted here

https://github.com/eerison/php-sdk/blob/7ebb1075693db6456d18aa65ec30bc9351c32253/src/Service/AbstractResourceService.php#L59-L75

How is $params constructed? For PHP:

it's a json, and it's working properly πŸ˜ƒ

Ah okay, everything resolved? good!

yeah, the integration with lib has worked, But need to be reviewed

PR: #35

please ignore the documentation at the moment I'm thinking to use material for MkDocs + github pages

Alright, asked Tim to take a look πŸ‘Œ

As this pull request there isn't any feedback, no make sense for me struggle with it anymore.