Skip to content

Instantly share code, notes, and snippets.

@sroehrl
Created February 12, 2023 00:19
Show Gist options
  • Save sroehrl/b2574aa295803fbb823fbbbce4902192 to your computer and use it in GitHub Desktop.
Save sroehrl/b2574aa295803fbb823fbbbce4902192 to your computer and use it in GitHub Desktop.
LENKRAD scripts when starting from scratch
#!/usr/bin/env php
<?php
use Neoan\Cli\Application;
use Neoan\Helper\Setup;
use Neoan\NeoanApp;
require_once __DIR__ . '/vendor/autoload.php';
$setup = new Setup();
$setup->setPublicPath(__DIR__ . '/public')
->setDatabaseAdapter(new \Neoan\Database\SqLiteAdapter(['location' => __DIR__ . '/db.db']))
->setLibraryPath(__DIR__ . '/src');
$console = new Application(new NeoanApp($setup, __DIR__));
$console->run();
{
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"require": {
"neoan.io/core": "^0.4"
}
}
#!/usr/bin/env php
<?php
shell_exec('php -S localhost:8080 public/index.php');
<?php
/*
*
* This file is in [root-directory]/public
*
*/
use Neoan\Database\SqLiteAdapter;
use Neoan\Helper\Setup;
use Neoan\NeoanApp;
use Neoan\Routing\AttributeRouting;
$projectPath = dirname(__DIR__);
require_once $projectPath . '/vendor/autoload.php';
$setup = new Setup();
$setup->setLibraryPath($projectPath . '/src')
->setDatabaseAdapter(new SqLiteAdapter(['location' => $projectPath . '/db.db']))
->setPublicPath(__DIR__);
$app = new NeoanApp($setup, dirname(__DIR__));
$app->invoke(new AttributeRouting('App'));
$app->run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment