XF 2.3 How do I rebuild cache for addons?

I made a custom addon.

None of the caches here have the option for addon caches: /admin.php?tools/rebuild

Any idea how I get the code changes in my addon to take effect on the site?

1759685985916.webp
 
user@device:/var/www/html$ php cmd.php xf-addon:rebuild Vendor\Addon
This is the command I use in the root of my installation, it will ask if your sure just type Y and press enter and it should work.

To see all the terminal commands you can do this: user@device:/var/www/html$ php cmd.php xf
 
Thanks!

Unfortunately, I'm on shared hosting and cannot use SSH/CLI, so the xf-addon:sync-json command is unavailable to me.

I'm hitting a fundamental issue with listener registration.

Goal: Register an entity_structure listener for the XF:Post entity.

The addon.json and Listener.php files are confirmed to be structurally correct on disk. My Listener.php contains a die('TEST'); command for debugging.

When I submit a reply, the die() command does not execute, and the post is successful. The listener is simply not running.

I checked the core table: the xf_code_event_listener table is completely empty for my add-on, even though the add-on is successfully installed. I've clicked "rebuild" and "sync" many times.

Given that the files are correct but the listener entry never makes it into the database, what is the most likely culprit?

1759689063417.webp
 
Thanks!

Unfortunately, I'm on shared hosting and cannot use SSH/CLI, so the xf-addon:sync-json command is unavailable to me.

I'm hitting a fundamental issue with listener registration.

Goal: Register an entity_structure listener for the XF:Post entity.

The addon.json and Listener.php files are confirmed to be structurally correct on disk. My Listener.php contains a die('TEST'); command for debugging.

When I submit a reply, the die() command does not execute, and the post is successful. The listener is simply not running.

I checked the core table: the xf_code_event_listener table is completely empty for my add-on, even though the add-on is successfully installed. I've clicked "rebuild" and "sync" many times.

Given that the files are correct but the listener entry never makes it into the database, what is the most likely culprit?

View attachment 328161
I've never used a shared hosting, especially for development. But when you create an event listener using the admin control panel, this should add it to the database table no?

Can you post your _output file and I can try and tell you what the issue is?
 
/src/addons/CustomAddon

Which has two files:

addon.json
Listener.php


Do I need vendor? I'm not using Composer or external PHP packages.

Code:
upload/
└── src/
    └── addons/
        └── CustomAddon/
            ├── addon.json
            ├── Listener.php
Okay first off how did you create this addon? To create an addon you need to run the command php cmd.php xf-addon:create This will insert the addon details into the database so it can be used when developing your addon.

Next, the code event listener, when you created that in the admin control panel, have you selected your addon? I don't see an _output dir. When you create an code event listener like so:
Screenshot 2025-10-06 195904.webp

You will get a file like this: src/addons/Sylphian/UserPets/_output/code_event_listeners/entity_post_save_d419d372af9128dbee867a5949acfd6f.json
JSON:
{
    "event_id": "entity_post_save",
    "execute_order": 50,
    "callback_class": "Sylphian\\UserPets\\Listener\\TutorialEvents",
    "callback_method": "userSave",
    "active": true,
    "hint": "XF\\Entity\\User",
    "description": "Tutorial Goal: upload_pfp"
}

What i'd suggest doing is taking a look at this section of the documentation https://github.com/xenforo-ltd/docs/pull/67 I wrote it myself for Xenforo 2.3.7 so I know it's up to date. It will walk you through creating a basic addon so you can get familiar with bits.

Also maybe moving development onto your own computer, would make your life easier. You'd be able to actually do commands which is kind of needed when your developing addons.
 
Back
Top Bottom