Roots Discourse

Composer package bootstrap.php failed

I’m likely asking a basic question here but something I’ve not quite found an answer to based on my searching.

Trying to install this oauth php library via composer and use it - https://github.com/Lusitanian/PHPoAuthLib

I followed these instructions as per the docs here

  1. themename -> composer require lusitanian/oauth
  2. curl -sS https://getcomposer.org/installer | php
  3. php composer.phar install

No errors.

Now I copied the example code for Etsy here into a page template: template-example.blade.php

The result is:

Fatal error : require_once(): Failed opening required ‘/tmp/sage-cache/bootstrap.php’ (include_path=’.:/usr/share/php’) in /tmp/sage-cache/a1e0684fa8db59f858c42a94673b906cd3d3c541.php on line 32

The failed line is require_once __DIR__ . '/bootstrap.php';

I ran the following afterwards:

  1. composer clearcache
  2. composer dump-autoload --optimize

No change of error.

Im still fairly new to using composer etc properly, wondering if I am missing a change needed considering this is on roots etc at all?

Thanks for any help.

  1. Don’t put this stuff in a View, use a Controller (or Composer if Sage 10).
  2. You probably don’t have bootstrap.php as it is located in the examples folder here as well as expects your credentials (e.g. init.php). I’d combine them all– they merely have them as separate files to make it easier to manage the rest of their examples.

Otherwise, all of this comes down to basic PHP and isn’t Composer related.

Thanks @Log1x. I’m really just taking this down to basics right now to learn it properly.

Before I start considering things like Controllers, I just want to be able to install and use this package for starters. Baby steps here ha.

Ok I get what you mean about maybe not having the bootstrap.php file considering where it is in that repo, however, where exactly would I put it? I know not to touch the /vendor/packagename therefore, where should it usually be located?

Just add the contents of bootstrap.php and init.php to your Etsy stuff.

Still might error though if something goes wrong during the View caching which is why you’re better off with a Controller– but the above should roughly be what you’re looking for…

1 Like

This topic was automatically closed after 42 days. New replies are no longer allowed.