Custom Action

68 views
Skip to first unread message

bigoaf

unread,
Jun 16, 2022, 3:18:17 AM6/16/22
to Fusio
Christoph

Firstly, thank you for creating this software - it is truly a magnificent piece of work.

I am attempting to write my first custom action by using the HelloWorld example, but I'm getting confused with paths. When you say "create a PHP file at src/Action/HelloWorld.php" where do you mean literally? Should that be in a vendor/fusio/adapter src directory or in a newly created directory somewhere?

Then do I add the namespace path to provider.php as:

'\App\Action\HelloWorld::class,'

Best regards

Bigoaf

Christoph Kappestein

unread,
Jun 16, 2022, 4:55:25 AM6/16/22
to Fusio
Hi Bigoaf,

thanks, yes the src/ folder does not exist by default so you need to create it at the root level and then you need to add there your action. You can also take a look at our sample repo s. https://github.com/apioo/fusio-sample-cms

best regards
Christoph

bigoaf

unread,
Jun 20, 2022, 3:02:30 AM6/20/22
to Fusio
Thanks for taking the time to reply Christoph, all working..

Will look at the CMS example for more tips too...

Best regards

Bigoaf

bigoaf

unread,
Aug 30, 2023, 6:43:49 AM8/30/23
to Fusio
Hi Christoph,

 I am upgrading Fusio to the latest version and am trying to migrate my custom actions.  I don't seem to be able to register the src/Actions as I used to with the autoload and provider.php files so that I can create the custom actions in the backend.  Is there another way of doing this now?

I have added the autoload App\\ src  but the new provider.hph file is in a different format so I cannot add the \App\Action\HelloWorld::class as I did before to the file in the action array
return [
    'action' => [
        \App\Action\HelloWorld::class

Best regards

Bigoaf
On Thursday, 16 June 2022 at 09:55:25 UTC+1 christoph....@gmail.com wrote:

Christoph Kappestein

unread,
Aug 31, 2023, 3:24:59 PM8/31/23
to Fusio
Hi Bigoaf,

with the new Fusio 4.0 release you don`t longer need to manually register your action at the provider.php file, you only need to place your action in the src/Action folder s. https://github.com/apioo/fusio-sample-cms/tree/master/src/Action and then you can autoload all action classes in the folder at the container.php file s. https://github.com/apioo/fusio-sample-cms/blob/master/resources/container.php#L11

best regards
Christoph

bigoaf

unread,
Sep 1, 2023, 4:03:09 AM9/1/23
to Fusio
That's worked for me - all migrated over.  Thank you Christoph.
Reply all
Reply to author
Forward
0 new messages