• ResourcesTutorials
  • How to install a Flarum Extension on shared hosting with limited PHP resources

This is a rough draft at best but I will try to explain as best as I can. This is a tutorial for people like me who are on a shared host and can't seem to install extensions through composer due to PHP resource limits set by the host.

Pre-requisites:
-Must have both SSH/FTP access

Example extension package:
-flagrow/flarum-ext-image-upload

Directions

1) Go to flarum root directory through FTP (whichever folder you installed Flarum on, most likely your url folder: home/user_name/url)

2) Create a new folder titled: “workbench”

3) Download repository folder from github (go to github of extension > Click Clone or download > Download ZIP)

4) Unzip folder and drop it into the workbench folder

5) Go to composer.json in the flarum root

6) Add the following lines after the require column

Example:

    "require": {
    "flarum/core": "^0.1.0",
    "flarum/flarum-ext-akismet": "^0.1.0",
    "flarum/flarum-ext-approval": "^0.1.0",
    
             },
    "repositories": [
    {
        "type": "path",
        "url": "workbench/*/"
    }
],

7) Add these the name of your extension followed by @dev after "franzl/studio": "^0.10.0"

Example:

           "require-dev": {
           "franzl/studio": "^0.10.0"
           "flagrow/flarum-ext-image-upload": "@dev"
                   }

8) Your composer.json folder should know look like this

  {
"name": "flarum/flarum",
"description": "Delightfully simple forum software.",
"type": "project",
"keywords": ["forum", "discussion"],
"homepage": "http://flarum.org",
"license": "MIT",
"authors": [
    {
        "name": "Toby Zerner",
        "email": "toby.zerner@gmail.com"
    },
    {
        "name": "Franz Liedke",
        "email": "franz@develophp.org"
    }
],
"support": {
    "issues": "https://github.com/flarum/core/issues",
    "source": "https://github.com/flarum/flarum",
    "docs": "http://flarum.org/docs"
},
 "require": {
    "flarum/core": "^0.1.0",
    "flarum/flarum-ext-akismet": "^0.1.0",
    "flarum/flarum-ext-approval": "^0.1.0", 
},
"repositories": [
    {
        "type": "path",
        "url": "workbench/*/"
    }
],
"require-dev": {
"franzl/studio": "^0.10.0"
"flagrow/flarum-ext-image-upload": "@dev"
 }
config": {
    "preferred-install": "dist"
},
"minimum-stability": "beta",
"prefer-stable": true
}

9) Access your server through ssh

10) Go to the flarum root directory

11) Use the composer command update

12) Your extension should now be installed!

13) Verify by going into the administration page of your website > extension > new extension button

blai changed the title to How to install a Flarum Extension on shared hosting with limited PHP resources .
a year later
a month later

i try but not work because my server still get limit source ?
i type

composer update

a year later
2 years later

Bet this doesn't work anymore, but im sure there is a new workaround with it. I am Having issues as the Require section is much more different, & getting an error code upon the Composer command update.

  [Seld\JsonLint\ParsingException]
  "./composer.json" does not contain valid JSON
  Parse error on line 73:
  ...studio": "^0.10.0" "flagrow/flarum-ext-...
  ---------------------^
  Expected one of: 'EOF', '}', ':', ',', ']'

    2svge your composer.json file has broken JSON syntax. This must have happened due to manual editing of the file. There's most likely a comma missing at the end of line 73.

    It's very likely that this guide is outdated by the way.

    Now that I re-read the original post, it's full of JSON syntax errors. If you try to use things from there, you will have to find and fix each one of them.

      5 days later

      clarkwinkelmann I figured so I completely reverted back to my original changes. I was just curious if there was another way to install plugins such as how Pockethold was installed for non-VPS users. Thanks for the info anyways!

      a month later

      Can't we just install extensions locally and then upload the vendors folder?

        Yes, as well as composer.json and composer.lock. That being said, only the official method is officially recommended.

        ikramy also just a note that Composer 2 (which should be possible to setup on your shared hosting pretty easily) is blazing my fast and I have yet to run into the resource errors that I faced CONSTANTLY with Composer 1 on Shared Hosting.