briannesbitt / Carbon

A simple PHP API extension for DateTime.
https://carbon.nesbot.com/
MIT License
16.53k stars 1.28k forks source link

No autoload.php in ZIP-Archive? #1962

Closed omexlu closed 4 years ago

omexlu commented 4 years ago

Hello,

For various reasons I can't use composer, so I wanted to do it without composer. The problem in the package is no autoload.php in ZIP-Archive of the actual version?

Without Composer Why are you not using composer? Download the Carbon latest release and put the contents of the ZIP archive into a directory in your project. Then require the file autoload.php to get all classes and dependencies loaded on need.

Thanks in advance.

kylekatarnls commented 4 years ago

You downloaded sources as ZIP I guess, last release available as package is 2.25.3

The asset is named Carbon-2.25.3.zip

Assets Source Code are only the source of the project without autoload nor dependencies.

kylekatarnls commented 4 years ago

Zip added for 2.26.0 and 2.27.0

Here is the link for 2.27.0: https://github.com/briannesbitt/Carbon/releases/download/2.27.0/Carbon-2.27.0.zip

For various reasons I can't use composer, so I wanted to do it without composer.

I doubt of this statement, anywhere you can run PHP, you can run composer, that's why we privilege this way of use and the ZIP release are in very-low priority for us.

omexlu commented 4 years ago

Hello,

Thanks for your answer, I tried with composer local on my PC (Ubuntu 18.04 with php 7.2x).

But since my webhosting 7.1.x is running, there were problems because php local and on the webhosting are not the same version.

kylekatarnls commented 4 years ago

Quick fix: Add "platform":{"php":"7.1"} to your composer.json so composer will not install any dependencies requiring a 7.2+ release.

Better solution: Install PHP 7.1 on your local machine (so you're working with an ISO-prod config)

Best solution: Switch both your webhost and local machine to the latest stable release: 7.4.0 so you benefit well maintained PHP and PHP-dependent package with the latest features and fixes.

omexlu commented 4 years ago

Thank you very much for your answer.

Unfortunately, I am a complete newcomer to composer, how can I insert this via composer? Or do I have to insert it manually?

For now i have removed carbon from the system!

Current composer.json and composer.lock:

{
    "require": {
        "vlucas/valitron": "^1.4",
        "phpmailer/phpmailer": "^6.1",
        "catfan/medoo": "^1.7",
        "mpratt/relativetime": "^1.5"
    }
}
{
    "_readme": [
        "This file locks the dependencies of your project to a known state",
        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
        "This file is @generated automatically"
    ],
    "content-hash": "c49797dd6b33fc2344da122a8f092d46",
    "packages": [
        {
            "name": "catfan/medoo",
            "version": "v1.7.7",
            "source": {
                "type": "git",
                "url": "https://github.com/catfan/Medoo.git",
                "reference": "d7aa617f8c4e2437b32f788f24adea01202032de"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/catfan/Medoo/zipball/d7aa617f8c4e2437b32f788f24adea01202032de",
                "reference": "d7aa617f8c4e2437b32f788f24adea01202032de",
                "shasum": ""
            },
            "require": {
                "ext-pdo": "*",
                "php": ">=5.4"
            },
            "suggest": {
                "ext-pdo_dblib": "For MSSQL or Sybase database on Linux/UNIX platform",
                "ext-pdo_mysql": "For MySQL or MariaDB database",
                "ext-pdo_oci": "For Oracle database",
                "ext-pdo_oci8": "For Oracle version 8 database",
                "ext-pdo_pqsql": "For PostgreSQL database",
                "ext-pdo_sqlite": "For SQLite database",
                "ext-pdo_sqlsrv": "For MSSQL database on both Window/Liunx platform"
            },
            "type": "framework",
            "autoload": {
                "psr-4": {
                    "Medoo\\": "/src"
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "MIT"
            ],
            "authors": [
                {
                    "name": "Angel Lai",
                    "email": "angel@catfan.me"
                }
            ],
            "description": "The lightweight PHP database framework to accelerate development",
            "homepage": "https://medoo.in",
            "keywords": [
                "database",
                "database library",
                "lightweight",
                "mariadb",
                "mssql",
                "mysql",
                "oracle",
                "php framework",
                "postgresql",
                "sql",
                "sqlite"
            ],
            "time": "2019-12-09T16:48:57+00:00"
        },
        {
            "name": "mpratt/relativetime",
            "version": "1.5.5",
            "source": {
                "type": "git",
                "url": "https://github.com/mpratt/RelativeTime.git",
                "reference": "1f15007be8a449ab7c808ba405bf9fc56137e097"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/mpratt/RelativeTime/zipball/1f15007be8a449ab7c808ba405bf9fc56137e097",
                "reference": "1f15007be8a449ab7c808ba405bf9fc56137e097",
                "shasum": ""
            },
            "require": {
                "php": ">=5.3"
            },
            "type": "library",
            "autoload": {
                "psr-0": {
                    "RelativeTime": "Lib/"
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "MIT"
            ],
            "authors": [
                {
                    "name": "Michael Pratt",
                    "email": "pratt@hablarmierda.net",
                    "homepage": "http://www.michael-pratt.com",
                    "role": "Author/Developer"
                }
            ],
            "description": "A library that calculates the time difference between two dates and returns the result in words (Example: 5 minutes ago or 5 Minutes left). The library supports other languages aswell like Spanish and German.",
            "homepage": "https://github.com/mpratt/RelativeTime",
            "keywords": [
                "ago",
                "date",
                "future",
                "interval",
                "relative",
                "time",
                "time-ago"
            ],
            "time": "2019-11-25T12:16:39+00:00"
        },
        {
            "name": "phpmailer/phpmailer",
            "version": "v6.1.4",
            "source": {
                "type": "git",
                "url": "https://github.com/PHPMailer/PHPMailer.git",
                "reference": "c5e61d0729507049cec9673aa1a679f9adefd683"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/c5e61d0729507049cec9673aa1a679f9adefd683",
                "reference": "c5e61d0729507049cec9673aa1a679f9adefd683",
                "shasum": ""
            },
            "require": {
                "ext-ctype": "*",
                "ext-filter": "*",
                "php": ">=5.5.0"
            },
            "require-dev": {
                "doctrine/annotations": "^1.2",
                "friendsofphp/php-cs-fixer": "^2.2",
                "phpunit/phpunit": "^4.8 || ^5.7"
            },
            "suggest": {
                "ext-mbstring": "Needed to send email in multibyte encoding charset",
                "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
                "league/oauth2-google": "Needed for Google XOAUTH2 authentication",
                "psr/log": "For optional PSR-3 debug logging",
                "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication",
                "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)"
            },
            "type": "library",
            "autoload": {
                "psr-4": {
                    "PHPMailer\\PHPMailer\\": "src/"
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "LGPL-2.1-only"
            ],
            "authors": [
                {
                    "name": "Marcus Bointon",
                    "email": "phpmailer@synchromedia.co.uk"
                },
                {
                    "name": "Jim Jagielski",
                    "email": "jimjag@gmail.com"
                },
                {
                    "name": "Andy Prevost",
                    "email": "codeworxtech@users.sourceforge.net"
                },
                {
                    "name": "Brent R. Matzelle"
                }
            ],
            "description": "PHPMailer is a full-featured email creation and transfer class for PHP",
            "time": "2019-12-10T11:17:38+00:00"
        },
        {
            "name": "vlucas/valitron",
            "version": "v1.4.7",
            "source": {
                "type": "git",
                "url": "https://github.com/vlucas/valitron.git",
                "reference": "a03072bed1679660200766d134507a30193eaf6d"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/vlucas/valitron/zipball/a03072bed1679660200766d134507a30193eaf6d",
                "reference": "a03072bed1679660200766d134507a30193eaf6d",
                "shasum": ""
            },
            "require": {
                "php": ">=5.3.2"
            },
            "require-dev": {
                "phpunit/phpunit": "^4.8.35 || ^5.5 || ^6.5"
            },
            "suggest": {
                "ext-mbstring": "It can support the multiple bytes string length."
            },
            "type": "library",
            "autoload": {
                "psr-4": {
                    "Valitron\\": "src/Valitron"
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "BSD-3-Clause"
            ],
            "authors": [
                {
                    "name": "Vance Lucas",
                    "email": "vance@vancelucas.com",
                    "homepage": "http://www.vancelucas.com"
                }
            ],
            "description": "Simple, elegant, stand-alone validation library with NO dependencies",
            "homepage": "http://github.com/vlucas/valitron",
            "keywords": [
                "valid",
                "validation",
                "validator"
            ],
            "time": "2019-08-29T19:49:43+00:00"
        }
    ],
    "packages-dev": [],
    "aliases": [],
    "minimum-stability": "stable",
    "stability-flags": [],
    "prefer-stable": false,
    "prefer-lowest": false,
    "platform": [],
    "platform-dev": []
}
kylekatarnls commented 4 years ago

You never have to edit manually your composer.lock

You can either run the command:

composer config platform.php 7.1

Or edit your composer.json as below:

{
    "require": {
        "vlucas/valitron": "^1.4",
        "phpmailer/phpmailer": "^6.1",
        "catfan/medoo": "^1.7",
        "mpratt/relativetime": "^1.5",
        "nesbot/carbon": "^2.27"
    },
    "config": {
        "platform": {
            "php": "7.1"
        }
    }
}

Replace 7.1 with the exact version number of your webhosting.

omexlu commented 4 years ago

Thank you works like a charm :)

Just for understandig: I wanted to compare two dates to get the past / future time in human form.

How can I do that with this date format '2019-12-15 15:00:00' compare with '2019-12-17 12:30:00'?

Thank you.

kylekatarnls commented 4 years ago

https://carbon.nesbot.com/docs/#api-humandiff

echo Carbon::parse('2019-12-15 15:00:00')->diffForHumans('2019-12-17 12:30:00');