A PHP Client Library for the Neocities.org REST API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
LICENSE.txt
README.md
composer.json

README.md

Neocities PHP Client Library

Neocities-php is a PHP wrapper of the Neocities.org API.

Installation

composer require reed-jones/neocities

Usage

// First we include the library
use ReedJones/Neocities/Neocities;

// Then we log in using either username/password or api key

$neocities = new Neocities([
    'username' => 'YOUR_USERNAME',
    'password' => 'YOUR_PASSWORD'
]);

// or

$neocities = new Neocities([
    'apiKey' => 'YOUR_API_KEY'
]);

Uploading Files

To upload files pass an array with the key being the desired upload name on the server, and the value being the path to the local file.

$result = $neocities->upload([
    'hello.html' => './local.html',
    'about.html' => './AboutMe.html'
]);

var_dump($result);

Deleting Files

To delete files from the server, simply pass an array of the files you wish to delete.

$result = $neocities->delete([
    'hello.html',
    'about.html'
]);

var_dump($result);

Listing All Files On Your Site

$result = $neocities->list();

var_dump($result);

Getting Information About Your Site

$result = $neocities->info();

var_dump($result);

Getting Your API Key

If you are logging in using your username/password, you can use this to retrieve your API key.

$result = $neocities->key();

var_dump($result);