php-school / learn-you-php Goto Github PK
View Code? Open in Web Editor NEWπ Learn You PHP! - An introduction to PHP's core features: i/o, http, arrays, exceptions and so on.
Home Page: http://www.phpschool.io/
License: MIT License
π Learn You PHP! - An introduction to PHP's core features: i/o, http, arrays, exceptions and so on.
Home Page: http://www.phpschool.io/
License: MIT License
Hello,
tried installing the package as per instructions, this could not be done because of warning about minimum required stability of packages via composer.
Ran self-update before trying to install, standard composer install to the best of my knowledge (so no change of minimum stability by me)
Pic :
On the time-server exercise, I get the following error when running:
$ learnyouphp verify time.php
time.php is the solution code from here: https://raw.githubusercontent.com/php-school/learn-you-php/master/exercises/time-server/solution/solution.php
PHP Fatal error: Uncaught Hoa\Socket\Client::_open(): (1) Client returns an error (number 111): Connection refused while trying to join tcp://127.0.0.1:55019.
in /home/michael/.php-school/workshops/learnyouphp/vendor/hoa/socket/Client.php at line 191.
thrown in /home/michael/.php-school/workshops/learnyouphp/vendor/hoa/socket/Client.php on line 191
Fatal error: Uncaught Hoa\Socket\Client::_open(): (1) Client returns an error (number 111): Connection refused while trying to join tcp://127.0.0.1:55019.
in /home/michael/.php-school/workshops/learnyouphp/vendor/hoa/socket/Client.php at line 191.
thrown in /home/michael/.php-school/workshops/learnyouphp/vendor/hoa/socket/Client.php on line 191
Hoa\Socket\Exception\Exception: Client returns an error (number 111): Connection refused while trying to join tcp://127.0.0.1:55019. in /home/michael/.php-school/workshops/learnyouphp/vendor/hoa/socket/Client.php on line 191
Call Stack:
0.0002 360312 1. {main}() /home/michael/.php-school/workshops/learnyouphp/bin/learnyouphp:0
0.0042 910536 2. PhpSchool\PhpWorkshop\Application->run() /home/michael/.php-school/workshops/learnyouphp/bin/learnyouphp:5
0.0291 3934080 3. PhpSchool\PhpWorkshop\CommandRouter->route() /home/michael/.php-school/workshops/learnyouphp/vendor/php-school/php-workshop/src/Application.php:194
0.0529 6942160 4. PhpSchool\PhpWorkshop\CommandRouter->resolveCallable() /home/michael/.php-school/workshops/learnyouphp/vendor/php-school/php-workshop/src/CommandRouter.php:131
0.0668 7771184 5. PhpSchool\PhpWorkshop\CommandRouter->callCommand() /home/michael/.php-school/workshops/learnyouphp/vendor/php-school/php-workshop/src/CommandRouter.php:213
0.0668 7771184 6. PhpSchool\PhpWorkshop\Command\VerifyCommand->__invoke() /home/michael/.php-school/workshops/learnyouphp/vendor/php-school/php-workshop/src/CommandRouter.php:233
0.0668 7771184 7. PhpSchool\PhpWorkshop\ExerciseDispatcher->verify() /home/michael/.php-school/workshops/learnyouphp/vendor/php-school/php-workshop/src/Command/VerifyCommand.php:83
0.1019 8329080 8. PhpSchool\PhpWorkshop\ExerciseRunner\CliRunner->verify() /home/michael/.php-school/workshops/learnyouphp/vendor/php-school/php-workshop/src/ExerciseDispatcher.php:156
0.1095 8369832 9. array_map() /home/michael/.php-school/workshops/learnyouphp/vendor/php-school/php-workshop/src/ExerciseRunner/CliRunner.php:143
0.1095 8369888 10. PhpSchool\PhpWorkshop\ExerciseRunner\CliRunner->PhpSchool\PhpWorkshop\ExerciseRunner\{closure}() /home/michael/.php-school/workshops/learnyouphp/vendor/php-school/php-workshop/src/ExerciseRunner/CliRunner.php:143
0.1095 8369888 11. PhpSchool\PhpWorkshop\ExerciseRunner\CliRunner->doVerify() /home/michael/.php-school/workshops/learnyouphp/vendor/php-school/php-workshop/src/ExerciseRunner/CliRunner.php:141
0.1097 8376584 12. PhpSchool\PhpWorkshop\ExerciseRunner\CliRunner->executePhpFile() /home/michael/.php-school/workshops/learnyouphp/vendor/php-school/php-workshop/src/ExerciseRunner/CliRunner.php:182
0.1107 8383304 13. PhpSchool\PhpWorkshop\Event\EventDispatcher->dispatch() /home/michael/.php-school/workshops/learnyouphp/vendor/php-school/php-workshop/src/ExerciseRunner/CliRunner.php:97
0.1107 8383304 14. PhpSchool\LearnYouPhp\Exercise\TimeServer->PhpSchool\LearnYouPhp\Exercise\{closure}() /home/michael/.php-school/workshops/learnyouphp/vendor/php-school/php-workshop/src/Event/EventDispatcher.php:44
0.2144 8735696 15. Hoa\Socket\Client->connect() /home/michael/.php-school/workshops/learnyouphp/src/Exercise/TimeServer.php:80
0.2145 8735744 16. Hoa\Socket\Client->__construct() /home/michael/.php-school/workshops/learnyouphp/vendor/hoa/socket/Connection/Connection.php:197
0.2150 8748304 17. Hoa\Socket\Client->open() /home/michael/.php-school/workshops/learnyouphp/vendor/hoa/stream/Stream.php:172
0.2150 8748304 18. Hoa\Stream\Stream::_getStream() /home/michael/.php-school/workshops/learnyouphp/vendor/hoa/stream/Stream.php:290
0.2151 8748744 19. Hoa\Socket\Client->_open() /home/michael/.php-school/workshops/learnyouphp/vendor/hoa/stream/Stream.php:213
Potential good source of programming problems / tasks
When I try to run "composer global require php-school/learn-you-php" I get below error. My php version is 5.6.17
PHP Fatal error: Class 'Composer\Installer\PackageEvents' not found in /Users/shailesh/.composer/vendor/php-school/workshop-installer/src/Plugin.php on line 42
Is it supposed to be looking at www.time.com, rather than running a web server request on the exercise file? I've glanced through the code, as well as poured over the instructions for the exercise and I'm not seeing where you're supposed to configure anything for the HTTP server that we're implementing.
Not clear if we're supposed to supply a domain to the script, or if that's supposed to be part of the run/verify scripts.
May I upload my solutions to the learnyouphp workshop to a git repository that I created.
I just wanted to ask before doing it.
thanks
We should be able to recursively include folders,
and there should be an option to ignore folders and files for example composer.lock
& vendor
folder entries should also be skipped, only files should be included.
I followede all the instructions here : https://www.phpschool.io/install#windows, but still i got [DomainException] windows is not supported error. any suggestion?
These are suggestions for new users.
Fail!
Hello π,
Thanks for using Hoa\Socket
!
I don't know if you are aware but the 1.0 version has been released! We really recommend to upgrade to this version if possible. We can help you to migrate too (see the README.md
to get help).
I just installed the workshop manager on my machine and verified, this was the return
β ~ workshop-manager verify
Verifying your installation
===========================
[OK] Your $PATH environment variable is configured correctly.
[OK] Your PHP version is 8.0.0, PHP 7.2 is the minimum supported version for this tool. Please note that some workshops
may require a higher version of PHP, so you may not be able to install them without upgrading PHP.
[OK] All required PHP extensions are installed. Please note that some workshops may require additional PHP extensions.
But when I tried to install the learnyouphp workshop that's what I get:
β ~ workshop-manager install -vvv learnyouphp
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Dependency resolution completed in 0.000 seconds
Your lock file does not contain a compatible set of packages. Please run composer update.
Problem 1
- beberlei/assert is locked to version v3.2.7 and an update of this package was not requested.
- beberlei/assert v3.2.7 requires php ^7 -> your php version (8.0.0) does not satisfy that requirement.
Problem 2
- beberlei/assert v3.2.7 requires php ^7 -> your php version (8.0.0) does not satisfy that requirement.
- php-school/cli-menu 4.1.0 requires beberlei/assert ^2.4 | ^3 -> satisfiable by beberlei/assert[v3.2.7].
- php-school/cli-menu is locked to version 4.1.0 and an update of this package was not requested.
There was a problem installing dependencies for "learnyouphp". Try running in verbose mode to see more details: /usr/local/bin/workshop-manager install -v
In Installer.php line 153:
[PhpSchool\WorkshopManager\Exception\ComposerFailureException]
Exception trace:
at phar:///usr/local/bin/workshop-manager/src/Installer/Installer.php:153
PhpSchool\WorkshopManager\Installer\Installer->PhpSchool\WorkshopManager\Installer\{closure}() at phar:///usr/local/bin/workshop-manager/src/Filesystem.php:23
PhpSchool\WorkshopManager\Filesystem->executeInPath() at phar:///usr/local/bin/workshop-manager/src/Installer/Installer.php:155
PhpSchool\WorkshopManager\Installer\Installer->installWorkshop() at phar:///usr/local/bin/workshop-manager/src/Command/InstallWorkshop.php:33
PhpSchool\WorkshopManager\Command\InstallWorkshop->__invoke() at n/a:n/a
call_user_func_array() at phar:///usr/local/bin/workshop-manager/vendor/php-di/invoker/src/Invoker.php:82
Invoker\Invoker->call() at phar:///usr/local/bin/workshop-manager/vendor/mnapoli/silly/src/Application.php:95
Silly\Application->Silly\{closure}() at phar:///usr/local/bin/workshop-manager/vendor/symfony/console/Command/Command.php:253
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/workshop-manager/vendor/symfony/console/Application.php:971
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/workshop-manager/vendor/symfony/console/Application.php:290
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/workshop-manager/vendor/symfony/console/Application.php:166
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/workshop-manager/app/bootstrap.php:49
require() at phar:///usr/local/bin/workshop-manager/bin/workshop-manager:3
require() at /usr/local/bin/workshop-manager:11
install <workshopName>
Is there a way to update the dependencies so that it will be possible to run the workshop on php 8 environments?
The instructions say that the port will be the first argument to the program, however when verifying, the output errors make it seem like it is sending the port as a second parameter with the localhost ipv4 address as the first argument.
Upon making adjustments to test this, the program started working, but I have been unable to determine why it is expecting times 12 hours into the future. I could have understood if it was basing on GMT/UTC, but there is no mention of timezone we should be formatting for in the instructions.
When I go to workshop-manager install learnyouphp
I get the error message in the title.
I also get the following warnings Notice: Use of undefined constant ARRAY_FILTER_USE_BOTH - assumed 'ARRAY_FILTER_USE_BOTH'
and Warning: array_filter() expects at most 2 parameters, 3 given in phar://...
before the final error message.
This is for new users in the command line.
In Exercise 1, you display the following info:
You can write to the console like so:
<?php
echo "text";
That is a bit confusing to people using the command line for the first time. Give some information on:
I'd like to translate it to Brasilian Portuguese.
what do you think , if we change a bit this folder structure ?
it will be more easy to contribute with another languages
$ sudo learnyouphp
PHP Fatal error: Uncaught exception 'PhpSchool\CliMenu\Exception\InvalidTerminalException' with message 'Terminal "Can't retrieve terminal details" is not a valid TTY' in /Users/l80/.composer/vendor/php-school/cli-menu/src/CliMenu.php:121
Stack trace:
#0 /Users/l80/.composer/vendor/php-school/cli-menu/src/CliMenu.php(98): PhpSchool\CliMenu\CliMenu->assertTerminalIsValidTTY()
#1 /Users/l80/.composer/vendor/php-school/cli-menu/src/CliMenu.php(317): PhpSchool\CliMenu\CliMenu->configureTerminal()
#2 /Users/l80/.composer/vendor/php-school/php-workshop/src/Command/MenuCommand.php(32): PhpSchool\CliMenu\CliMenu->open()
#3 [internal function]: PhpSchool\PhpWorkshop\Command\MenuCommand->__invoke('/usr/local/bin/...')
#4 /Users/l80/.composer/vendor/php-school/php-workshop/src/CommandRouter.php(169): call_user_func_array(Object(PhpSchool\PhpWorkshop\Command\MenuCommand), Array)
#5 /Users/l80/.composer/vendor/php-school/php-workshop/src/CommandRouter.php(153): PhpSchool\PhpWorkshop\CommandRouter->callCommand in /Users/l80/.composer/vendor/php-school/cli-menu/src/CliMenu.php on line 121
$ sw_vers -productVersion
10.11.3
Hi,
I have installed and I verify that everything is ok with workshop-manager in my machine with ubuntu and php 7.0.12 but when I tried to install learnyouphp I got this error:
PHP Fatal error: Uncaught Error: Class 'ZipArchive' not found in phar:///usr/local/bin/workshop-manager/src/Installer/Installer.php:136
The solution https://github.com/php-school/learn-you-php/tree/master/test/res/dependency-heaven/good-solution is not actually correct
the exercise ask for the number of newlines, but what is the correct answer for strings that without a newline at end?
for example, "line1\nline2" should be count as 2 lines, but it actually has only 1 newline char.
and the funny part is "wc -l" also show "1" for this case.
Hi, I'm trying to install via composer. But it always failed even if I'm cleared composer cache. Here is the error message
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: remove symfony/process v2.6.5
- Installation request for php-school/learn-you-php ^0.2.10 -> satisfiable by php-school/learn-you-php[0.2.10].
- Conclusion: don't install symfony/process v3.0.2
- Conclusion: don't install symfony/process v2.6.5|install symfony/process v3.0.2
- php-school/learn-you-php 0.2.10 requires php-school/php-workshop ^0.3@dev -> satisfiable by php-school/php-workshop[0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5].
- php-school/php-workshop 0.3.0 requires symfony/process ^2.7 -> satisfiable by symfony/process[v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.1, v2.8.2].
- php-school/php-workshop 0.3.1 requires symfony/process ^2.7 -> satisfiable by symfony/process[v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.1, v2.8.2].
- php-school/php-workshop 0.3.2 requires symfony/process ^2.7 -> satisfiable by symfony/process[v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.1, v2.8.2].
- php-school/php-workshop 0.3.3 requires symfony/process ^2.7 -> satisfiable by symfony/process[v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.1, v2.8.2].
- php-school/php-workshop 0.3.4 requires symfony/process ^2.7 -> satisfiable by symfony/process[v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.1, v2.8.2].
- php-school/php-workshop 0.3.5 requires symfony/process ^2.7|^3.0 -> satisfiable by symfony/process[v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.1, v2.8.2, v3.0.0, v3.0.1, v3.0.2].
- Can only install one of: symfony/process[v2.7.0, v2.6.5].
- Can only install one of: symfony/process[v2.7.1, v2.6.5].
- Can only install one of: symfony/process[v2.7.2, v2.6.5].
- Can only install one of: symfony/process[v2.7.3, v2.6.5].
- Can only install one of: symfony/process[v2.7.4, v2.6.5].
- Can only install one of: symfony/process[v2.7.5, v2.6.5].
- Can only install one of: symfony/process[v2.7.6, v2.6.5].
- Can only install one of: symfony/process[v2.7.7, v2.6.5].
- Can only install one of: symfony/process[v2.7.8, v2.6.5].
- Can only install one of: symfony/process[v2.7.9, v2.6.5].
- Can only install one of: symfony/process[v2.8.0, v2.6.5].
- Can only install one of: symfony/process[v2.8.1, v2.6.5].
- Can only install one of: symfony/process[v2.8.2, v2.6.5].
- Can only install one of: symfony/process[v3.0.0, v2.6.5].
- Can only install one of: symfony/process[v3.0.1, v2.6.5].
- Installation request for symfony/process == 2.6.5.0 -> satisfiable by symfony/process[v2.6.5].
Installation failed, reverting ./composer.json to its original content.
I'm using php 5.6.16
> php -v
PHP 5.6.16 (cli) (built: Dec 13 2015 15:06:28)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Xdebug v2.3.3, Copyright (c) 2002-2015, by Derick Rethans
Composer global require is a cool way to make the workshop manager available to the entire system without all that messing about with curl and chmod. It's easy enough to do this, if someone says it would be useful, I will make it so...
using elementary os, fish shell, php-fpm 7.0.3
cannot navigate learnyouphp menu.
seems completely unresponsive except to the "enter" key.
as such, I'm stuck on hello world
It's only minor, but the solution for My First IO contains an escaped character which escapes in the terminal output too.
If you output the correct results but in a different order to our solution then it will fail. I'm not sure how we would fix this but it's worth a look. Or maybe the best way is to say to do it in a particular order in the exercise task.
https://github.com/php-school/learn-you-php/blob/master/src/Exercise/DependencyHeaven.php should use php-school/php-workshop#49 & php-school/php-workshop#48 when finished and merged
For exercise β8 "Database Read" package php5-sqlite should be installed on Ubuntu.
Without it the runner and verifier will throw PDOException with message 'could not find driver'.
I guess, this is not by design and should be mentioned in requirements or hints.
Also, after installation of missing packages and running learnyouphp run again, the RuntimeException with message 'Database directory /tmp/... already exists' throwed.
Deleting of mentioned folder of course helps.
The current libraries are no longer working. I would suggest guzzle
and symfony/string
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.