Move to using AntLoader

This commit is contained in:
Belle Aerni 2023-05-04 14:42:36 -07:00
parent e6a59c0b16
commit 0a9b067ef5
5 changed files with 269 additions and 19 deletions

View file

@ -11,7 +11,7 @@ updates:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/.github"
directory: "/"
schedule:
interval: "daily"

View file

@ -9,15 +9,16 @@
"issues": "https://github.com/AntCMS-org/AntCMS/issues"
},
"require": {
"symfony/yaml": "^6.0",
"php": ">=8.0",
"league/commonmark": "^2.3",
"antcms/antloader": "dev-main",
"elgigi/commonmark-emoji": "^2.0",
"twig/twig": "^3.5",
"shapecode/twig-string-loader": "^1.1",
"embed/embed": "^4.4",
"league/commonmark": "^2.3",
"nyholm/psr7": "^1.5",
"simonvomeyser/commonmark-ext-lazy-image": "^2.0"
"shapecode/twig-string-loader": "^1.1",
"simonvomeyser/commonmark-ext-lazy-image": "^2.0",
"symfony/yaml": "^6.0",
"twig/twig": "^3.5"
},
"authors": [
{
@ -26,7 +27,8 @@
}
],
"config": {
"vendor-dir": "src/Vendor"
"vendor-dir": "src/Vendor",
"sort-packages": true
},
"require-dev": {
"phpstan/phpstan": "^1.9",

256
composer.lock generated
View file

@ -4,8 +4,53 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "0e7b539782d869814d383d3b41cd43a5",
"content-hash": "73b53c4909e18e7ac2935d0c63beeb2d",
"packages": [
{
"name": "antcms/antloader",
"version": "dev-main",
"source": {
"type": "git",
"url": "https://github.com/AntCMS-org/AntLoader.git",
"reference": "e9ca0badde335afaff09ffd0d12c1f07c476bfa4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/AntCMS-org/AntLoader/zipball/e9ca0badde335afaff09ffd0d12c1f07c476bfa4",
"reference": "e9ca0badde335afaff09ffd0d12c1f07c476bfa4",
"shasum": ""
},
"require": {
"composer/class-map-generator": "^1.0",
"php": ">=8.0"
},
"require-dev": {
"phpstan/phpstan": "^1.10"
},
"default-branch": true,
"type": "library",
"autoload": {
"psr-4": {
"Antcms\\Antloader\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Belle Aerni",
"email": "belleaerni@gmail.com"
}
],
"description": "A small and simple autoloader for PHP applications",
"support": {
"issues": "https://github.com/AntCMS-org/AntLoader/issues",
"source": "https://github.com/AntCMS-org/AntLoader/tree/main"
},
"time": "2023-05-04T21:25:38+00:00"
},
{
"name": "composer/ca-bundle",
"version": "1.3.5",
@ -82,6 +127,150 @@
],
"time": "2023-01-11T08:27:00+00:00"
},
{
"name": "composer/class-map-generator",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/composer/class-map-generator.git",
"reference": "1e1cb2b791facb2dfe32932a7718cf2571187513"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/class-map-generator/zipball/1e1cb2b791facb2dfe32932a7718cf2571187513",
"reference": "1e1cb2b791facb2dfe32932a7718cf2571187513",
"shasum": ""
},
"require": {
"composer/pcre": "^2 || ^3",
"php": "^7.2 || ^8.0",
"symfony/finder": "^4.4 || ^5.3 || ^6"
},
"require-dev": {
"phpstan/phpstan": "^1.6",
"phpstan/phpstan-deprecation-rules": "^1",
"phpstan/phpstan-phpunit": "^1",
"phpstan/phpstan-strict-rules": "^1.1",
"symfony/filesystem": "^5.4 || ^6",
"symfony/phpunit-bridge": "^5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Composer\\ClassMapGenerator\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "https://seld.be"
}
],
"description": "Utilities to scan PHP code and generate class maps.",
"keywords": [
"classmap"
],
"support": {
"issues": "https://github.com/composer/class-map-generator/issues",
"source": "https://github.com/composer/class-map-generator/tree/1.0.0"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2022-06-19T11:31:27+00:00"
},
{
"name": "composer/pcre",
"version": "3.1.0",
"source": {
"type": "git",
"url": "https://github.com/composer/pcre.git",
"reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2",
"reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2",
"shasum": ""
},
"require": {
"php": "^7.4 || ^8.0"
},
"require-dev": {
"phpstan/phpstan": "^1.3",
"phpstan/phpstan-strict-rules": "^1.1",
"symfony/phpunit-bridge": "^5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.x-dev"
}
},
"autoload": {
"psr-4": {
"Composer\\Pcre\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
}
],
"description": "PCRE wrapping library that offers type-safe preg_* replacements.",
"keywords": [
"PCRE",
"preg",
"regex",
"regular expression"
],
"support": {
"issues": "https://github.com/composer/pcre/issues",
"source": "https://github.com/composer/pcre/tree/3.1.0"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2022-11-17T09:50:14+00:00"
},
{
"name": "dflydev/dot-access-data",
"version": "v3.0.2",
@ -1320,6 +1509,67 @@
],
"time": "2022-01-02T09:55:41+00:00"
},
{
"name": "symfony/finder",
"version": "v6.0.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "5cc9cac6586fc0c28cd173780ca696e419fefa11"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/5cc9cac6586fc0c28cd173780ca696e419fefa11",
"reference": "5cc9cac6586fc0c28cd173780ca696e419fefa11",
"shasum": ""
},
"require": {
"php": ">=8.0.2"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Finder\\": ""
},
"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": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/v6.0.19"
},
"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": "2023-01-20T17:44:14+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.27.0",
@ -3563,7 +3813,9 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {
"antcms/antloader": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {

View file

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

View file

@ -4,9 +4,14 @@ error_reporting(E_ALL);
ini_set('display_errors', '1');
require_once __DIR__ . DIRECTORY_SEPARATOR . 'Vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
require_once __DIR__ . DIRECTORY_SEPARATOR . 'Autoload.php';
require_once __DIR__ . DIRECTORY_SEPARATOR . 'Constants.php';
$classMapPath = __DIR__ . DIRECTORY_SEPARATOR . 'Cache' . DIRECTORY_SEPARATOR . 'classMap.php';
$loader = new AntCMS\AntLoader($classMapPath );
$loader->addPrefix('AntCMS\\', __DIR__ . DIRECTORY_SEPARATOR . 'AntCMS');
$loader->checkClassMap();
$loader->register();
use AntCMS\AntCMS;
use AntCMS\AntConfig;
use AntCMS\AntPages;