Created an autoloader

This commit is contained in:
Belle Aerni 2023-01-06 13:40:02 -08:00
parent 61e24b2b71
commit d6e4338689
10 changed files with 179 additions and 6 deletions

View File

@ -4,7 +4,8 @@
"description": "A simple CMS built with PHP and Markdown",
"minimum-stability": "stable",
"require": {
"michelf/php-markdown": "^2.0"
"michelf/php-markdown": "^2.0",
"symfony/yaml": "^6.0"
},
"autoload": {
"psr-4": {

158
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "c7f343aa119f2ca464f00c05981fff99",
"content-hash": "23fb12ebd55b99f3fce96f880a2f579e",
"packages": [
{
"name": "michelf/php-markdown",
@ -61,6 +61,162 @@
"source": "https://github.com/michelf/php-markdown/tree/2.0.0"
},
"time": "2022-09-26T12:21:08+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.27.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "5bbc823adecdae860bb64756d639ecfec17b050a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a",
"reference": "5bbc823adecdae860bb64756d639ecfec17b050a",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"provide": {
"ext-ctype": "*"
},
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.27-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-11-03T14:55:06+00:00"
},
{
"name": "symfony/yaml",
"version": "v6.0.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "76c08913ea1c50541503a4563b2172710189fa29"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/76c08913ea1c50541503a4563b2172710189fa29",
"reference": "76c08913ea1c50541503a4563b2172710189fa29",
"shasum": ""
},
"require": {
"php": ">=8.0.2",
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
"symfony/console": "<5.4"
},
"require-dev": {
"symfony/console": "^5.4|^6.0"
},
"suggest": {
"symfony/console": "For validating YAML files using the lint command"
},
"bin": [
"Resources/bin/yaml-lint"
],
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Loads and dumps YAML files",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/yaml/tree/v6.0.17"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-12-14T15:52:41+00:00"
}
],
"packages-dev": [],

9
src/AntCMS/AntYaml.php Normal file
View File

@ -0,0 +1,9 @@
<?php
namespace AntCMS;
use Symfony\Component\Yaml\Yaml;
class AntYaml{
}
?>

9
src/Autoload.php Normal file
View File

@ -0,0 +1,9 @@
<?php
spl_autoload_register(function($class) {
$class = str_replace('\\', '/', $class);
$path = __DIR__ . '/' . $class . '.php';
if (is_readable($path)) {
require_once $path;
}
});

0
src/Cache/.gitkeep Normal file
View File

View File

@ -5,11 +5,9 @@ ini_set('display_errors', 1);
const AntDir = __DIR__;
const AntCache = __DIR__ . '/Cache';
const antConfig = __DIR__ . '/config.ymal';
require_once __DIR__ . '/Vendor/autoload.php';
require_once __DIR__ . '/AntCMS/App.php';
require_once __DIR__ . '/AntCMS/Markdown.php';
require_once __DIR__ . '/AntCMS/Keywords.php';
require_once __DIR__ . '/AntCMS/Cache.php';
require_once __DIR__ . '/Autoload.php';
use AntCMS\AntCMS;