How do I load a third party PHP library? I have a third party php library which I would like to use in a module. How do I do that in Drupal 8? In drupal 7, I have done things like the following code, but libraries_get_path() doesn't exist in Drupal 8, and I'm not exactly sure how things change, not that we use namespaces (of which I am a beginner).

require(libraries_get_path('twitter-api-php') . '/TwitterAPIExchange.php');


And, where should I place my library? Should I create a new libraries directory and put it in the root, just like modules and themes are now in the root?
The 8.x-3.x branch of the Libraries module still provides the libraries_get_path() function. And (as of now) it looks pretty much unchanged. So you should be able to use it in the same way.

As far as where to put your library, the libraries_get_libraries() function has been updated with the following addition to the $searchdir array:

// Always search the root 'libraries' directory.
$searchdir[] = 'libraries';


Which indicates that you can place your libraries in a directory named "libraries" at your site root.