PHP code example of reun / nanomanager

1. Go to this page and download the library: Download reun/nanomanager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

reun / nanomanager example snippets




use Reun\Nanomanager\Nanomanager;

// ublic/uploads", // Path to directory where Nanomanager stores files
  "https://example.com/uploads", // Public URL of the directory
  "https://example.com/admin/nanomanager" // URL to access Nanomanager
);

echo $nanomanager->run();

$app->any("/admin/nanomanager", function($request, $response) {
  $nanomanager = new Nanomanager\Nanomanager(...);

  $response->getBody()->write($nanomanager->run(
      $request->getMethod(),
      (string) $request->getBody(),
  ));

  return $response;
});

new Nanomanager(..., createMissingDirectory: false);

new Nanomanager(..., frontendAttributes: 'theme="dark"');

$proto = ($_SERVER['HTTPS'] ?? false) ? 'https' : 'http';
$host = is_string($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
$urlBase = "{$proto}://{$host}";

// Override dynamic URL in production
if($isProduction) {
  $urlBase = "https://example.com";
}

$nanomanager = new Nanomanager(
    "path/to/uploads",
    "{$urlBase}/uploads",
    "{$urlBase}/admin/nanomanager",
);