Code Monkey home page Code Monkey logo

Comments (8)

samdark avatar samdark commented on August 25, 2024 1

Thanks for feedback, @lubosdz.

I've re-tested starting from scratch:

git clone [email protected]:yiisoft/demo.git
cd demo
composer install
./yii serve

Then opened http://localhost:8080/ and got a working demo.

Things to be improved:

  1. Yii3 could be installed with Composer 2 only since version 1 doesn't see many of it's packages at all (that was announced by Composer team wheny they've deprecated version 1). I don't think we can improve it but mentioning it is a good idea.
  2. During composer install it asks for trusting plugins. That could be part of composer.json so it installs right away.
  3. Dependencies should be reviewed, indeed. While Yii 3 is divided into many packages, removing unnecessary onces is a good idea.
  4. PHP 8 is already 34% of all PHP installations and is going up. I assume that it will increase soon and that older PHP versions are used in legacy projects while new ones are started with new PHP versions.
  5. We suck at marketing, I know. But overall:
  • It is less magic. It is, actually, quite strict in practices used.
  • It has nearly 100% test/type coverage.
  • It it leveraging and implementing PSRs.
  • It suits projects of any sizes and any architectures.
  • No vendor lock. It is wide open to PHP community in general.
  • Suits TDD and unit-testing well.
  • Aids you during debug with great error screen, logs, friendly exceptions etc.
  • Code you write is the code executed. No pre-generation is involved.

from demo.

samdark avatar samdark commented on August 25, 2024

We don't need package-lock.json and yarn.lock anymore since foxy was replaced with asset-packagist in demo and app.

from demo.

samdark avatar samdark commented on August 25, 2024

It's alright to have it.

from demo.

lubosdz avatar lubosdz commented on August 25, 2024

Well, that foxy needs some polishing .. cannot make work composer update, cannot downgrade PHP below 8.0 :-|
Using phar composer 2.2.5 (latest).

......
  - Locking yiisoft/yii-http (1.0.0)
  - Locking yiisoft/yii-middleware (dev-master 38ad72a)
  - Locking yiisoft/yii-runner (1.0.0)
  - Locking yiisoft/yii-runner-console (1.0.0)
  - Locking yiisoft/yii-runner-http (1.0.0)
  - Locking yiisoft/yii-swagger (1.1.0)
  - Locking yiisoft/yii-view (4.0.2)
  - Locking yosymfony/resource-watcher (v2.0.1)
  - Locking zircote/swagger-php (4.2.4)
Writing lock file
Installing dependencies from lock file (including require-dev)

Fatal error: Uncaught TypeError: Composer\Package\Locker::__construct(): Argument #3 ($installationManager) must be of type Composer\Installer\InstallationManager, Composer\Repository\RepositoryManager given, called in D:\_projects\yii3\yii-demo\vendor\foxy\foxy\Util\LockerUtil.php on line 41 and defined in phar://D:/_projects/composer-2.2.5.phar/src/Composer/Package/Locker.php:63
Stack trace:
#0 D:\_projects\yii3\yii-demo\vendor\foxy\foxy\Util\LockerUtil.php(41): Composer\Package\Locker->__construct(Object(Composer\IO\ConsoleIO), Object(Composer\Json\JsonFile), Object(Composer\Repository\RepositoryManager), Object(Composer\Installer\InstallationManager), '{\n    "name": "...')
#1 D:\_projects\yii3\yii-demo\vendor\foxy\foxy\Fallback\ComposerFallback.php(101): Foxy\Util\LockerUtil::getLocker(Object(Composer\IO\ConsoleIO), Object(Composer\Repository\RepositoryManager), Object(Composer\Installer\InstallationManager), './composer.json')
#2 D:\_projects\yii3\yii-demo\vendor\foxy\foxy\Foxy.php(179): Foxy\Fallback\ComposerFallback->save()
#3 [internal function]: Foxy\Foxy->init(Object(Composer\Installer\InstallerEvent))
#4 phar://D:/_projects/composer-2.2.5.phar/src/Composer/EventDispatcher/EventDispatcher.php(192): call_user_func(Array, Object(Composer\Installer\InstallerEvent))
#5 phar://D:/_projects/composer-2.2.5.phar/src/Composer/EventDispatcher/EventDispatcher.php(152): Composer\EventDispatcher\EventDispatcher->doDispatch(Object(Composer\Installer\InstallerEvent))
#6 phar://D:/_projects/composer-2.2.5.phar/src/Composer/Installer.php(714): Composer\EventDispatcher\EventDispatcher->dispatchInstallerEvent('pre-operations-...', true, true, Object(Composer\DependencyResolver\LocalRepoTransaction))
#7 phar://D:/_projects/composer-2.2.5.phar/src/Composer/Installer.php(583): Composer\Installer->doInstall(Object(Composer\Repository\InstalledFilesystemRepository), true)
#8 phar://D:/_projects/composer-2.2.5.phar/src/Composer/Installer.php(279): Composer\Installer->doUpdate(Object(Composer\Repository\InstalledFilesystemRepository), true)
#9 phar://D:/_projects/composer-2.2.5.phar/src/Composer/Command/InstallCommand.php(139): Composer\Installer->run()
#10 phar://D:/_projects/composer-2.2.5.phar/vendor/symfony/console/Command/Command.php(245): Composer\Command\InstallCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 phar://D:/_projects/composer-2.2.5.phar/vendor/symfony/console/Application.php(835): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 phar://D:/_projects/composer-2.2.5.phar/vendor/symfony/console/Application.php(185): Symfony\Component\Console\Application->doRunCommand(Object(Composer\Command\InstallCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 phar://D:/_projects/composer-2.2.5.phar/src/Composer/Console/Application.php(336): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 phar://D:/_projects/composer-2.2.5.phar/vendor/symfony/console/Application.php(117): Composer\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 phar://D:/_projects/composer-2.2.5.phar/src/Composer/Console/Application.php(131): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 phar://D:/_projects/composer-2.2.5.phar/bin/composer(83): Composer\Console\Application->run()
#17 D:\_projects\composer-2.2.5.phar(29): require('phar://D:/_proj...')
#18 {main}
  thrown in phar://D:/_projects/composer-2.2.5.phar/src/Composer/Package/Locker.php on line 63

from demo.

vjik avatar vjik commented on August 25, 2024

@lubosdz maybe foxy/foxy don't support composer 2.2?
Try composer 2.1.

from demo.

lubosdz avatar lubosdz commented on August 25, 2024

So it worked finally with composer 2.0.14 (probably 2.0.X branch) - with warnings not supported version of composer, PHP.
Configured CLI PHP path to 8.0.13.
Installing 125 installs, 87 updates, 25 removals.
Crash yii-console has unpushed changes ...
Deleted again whole vendor directory and ran composer install.
Installing 222 installs, 0 updates, 0 removals.
Now it worked.
Another exception - required PHP >= 8.0.2 for HTTP requests.
OK, switched WAMP to 8.0.13.
Next exception .env invalid path.
OK - created .env file from env.example. IMO .env file should not be required, but assume default DEVEL settings if not found.
Next exception Class "Cycle\Database\Config\SQLiteDriverConfig" not found in yii-demo\config\params.php in line 153:
I gave up, file is missing in repo, cannot make running yii3 demo :-(

Few notes:

  • 222 dependencies for Yii3 demo is really a lot. Symfony sample app has 131 installs, laravel 110 installs.
  • each dependency maintained by third party may potentially become issue over time, if becomes unmaintained or is not updated synchronically with framework updates. For example currently foxy/foxy does not support PHP 8.1 and that limits maximum used PHP version for ALL packages. Therefore third party packages should be reduced to absolute minimum and/or somehow confirmed by maintainers that they will be able to maintain if necessary for framework purpose. I am aware that it is idealistic, but don't know any better how to ensure that thousands of projects depending framework will not be jeopartized by a single package. It may not be easy to switch to alternative package for many projects. This issue applies mainly to a single open source maintainers, probably not 3rd party framework packages.
  • installing demo app should be smooth experience, or it creates barrier to other developers willing to test & contribute to development.
  • i still think increasing min. PHP version to 8.0 (8.0.2) has heavily limited targetted developers. PHP 7.4 could be sufficient targeting much wider community. Don't create tool for a few developers crazy about few newest features, create tool for widest community.
  • yii3 is missing something like "marketing gists" - meaning provide answers such as how will it differ from symfony and laravel, what advantages will it have or why should I invest my time to studying Yii3 and not use laravel/symfony with existing huge community and documentation. Yii3 core developers should also consult with less experienced developers on their opinion to understand whether Yii3 will be easy to learn. To me it seems overengineered with high learning curve - so answering those questions may be the interest of many others.

from demo.

lubosdz avatar lubosdz commented on August 25, 2024

@samdark
Thank you for feedback.
Yes, trusted plugins should be directly committed to composer file and unnecessary packages removed.
I re-tested demo site once again today on another computer - following exact steps you wrote above.
And yes - it worked now - but partially.
No missing Cycle config file anymore.
The difference I see:

  • you served HTTP requests via ./yii serve . I use common WAMP server, no virtual hosts. Seems homeUrl is not calculated correctly for WAMP (or any local server on port 80). Site loaded fine when I accessed via http://localhost:8080/, but not when accessed via standard URL http://localhost/yii3/demo/public/.

I may try to debug & supply PR if I have more time, unless won't be fixed till then.

from demo.

samdark avatar samdark commented on August 25, 2024

Yes, that's known thing. Currently there's no support for subdirectories out of the box and it should be added via https://github.com/yiisoft/yii-middleware/blob/master/src/SubFolder.php to the main middleware settings. That was done to avoid unneeded entry point calculations in case there's no sub-directory involved (which is majority of cases).

from demo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.