A standalone editor playground for PHPantom's Yii 3 support. It is the
application yiisoft/app generates, with the tooling trimmed off and a small
blog added: a route group, a controller, views rendered through an alias, a
DI definition, and a book catalog kept in Active Records, each declared the
way a real Yii 3 project declares them.
- Open
config/common/routes.php. Theblog/group's routes name their handlers as[PostController::class, 'index']and[PostController::class, 'view']. Go to the definition of'view', find its references, or rename it, and the method insrc/Web/Blog/PostController.phpfollows. - Open
resources/views/blog/index.php. Go to the definition of'blog/post'in$urlGenerator->generate(), which lands on the route that declares it under its group'sblog/prefix. Complete route names there, and the'slug'key, which goes to the{slug}placeholder the route's path declares and shows that path on hover. InPostController::view(),#[RouteArgument('slug')]goes to that{slug}and completes from it, and a name the path does not declare is reported. - Open
config/common/di/blog.php. Go to the definition ofInMemoryPostRepository, the class the container builds forPostRepositoryInterface. The definition's keys name what they configure:'__construct()'goes to the constructor and'posts'to its$posts,'setLogger()'to the method, and'$pageSize'to the property. RenamesetLogger()insrc/Blog/InMemoryPostRepository.phpand the key follows. Clear a key to complete it, or misspell one to see it reported. Drop the$from'$pageSize'to see the key reported with a fix that puts it back, or set it to'5'to see the value reported, since the property takes anint. - Open
config/common/events.php. Go to the definition of'count'in[ViewCounter::class, 'count'], which openssrc/Blog/ViewCounter.php. Clear it to completeViewCounter's public methods, renamecount()and the string follows, or misspell it to see it reported. Point it at'viewsOf'to see the listener reported, since itsstring $slugcan be filled with neither the event nor a service, and drop thePostViewedtype from the closure's$eventfor the same report. Opensrc/Blog/PostViewed.phpfor the lens listing its listeners, which go-to-implementation on the class name lists too. - Open
resources/views/blog/post.php. Go to the definition of'author'inField::text($comment, 'author'), which lands on the property insrc/Web/Blog/CommentForm.php. Clear the string to complete the form's properties, misspell it to see it reported, or rename the property and both fields follow. InPostController::comment(), the keys of the mappopulateFromPost()is given name the same properties, and navigate, complete, and are checked the same way. - Open
src/Blog/PostRepositoryInterface.php. The lens above the interface, and go-to-implementation on its name, lead to the definition that binds it. Go-to-implementation onLoggerInterfaceinReference::to()does the same for the logger. - In
PostController::view(), hover$postor complete after$post->. The repository's interface declares whatfindBySlug()returns. - Open
resources/views/blog/index.php. Hover$postinside the loop, or complete after$post->. The template declares the variables the controller passes it with@var. - In
PostController::index(), go to the definition of'posts'in the arrayrender()passes, which lands on its@varinresources/views/blog/index.php, or hover it for its type. Clear a key to complete the parameters the template declares. A value the declaration does not accept, a key the template has no use for, and a declared parameter the call leaves out are reported.$urlGeneratoris not one the call has to pass:config/common/params.phpgives it to every view. - In
PostController::index(), go to the definition of'index'. The controller'swithViewPath('@views/blog')and the@viewsalias inconfig/common/aliases.phpmake itresources/views/blog/index.php. Clear the name to complete it from the views there, and misspell it to see it reported.src/Web/HomePage/Action.phpnames its template as__DIR__ . '/template'instead, andindex.phprenders'_card'from beside itself. Openresources/views/blog/_card.phpfor the lens listing the calls that render it. - In
PostController::view(), go to the definition of thewithLayout()argument, which openssrc/Web/Shared/Layout/Main/layout.php. It completes like a view name, and a layout with no file is reported, as is awithViewPath()directory that does not exist. - Open
src/Web/Shared/Layout/Main/MainAsset.php. Go to the definition of'@assetsSource'in$sourcePath, which lands on its declaration inconfig/common/aliases.php, or hover it for the path it stands for. The rest of the string,/main, links to theassets/maindirectory, and an@typed in any string completes the declared aliases. Search workspace symbols for@assetsSourceto find its declaration, and in an editor that shows folded text, fold the string to see the path it resolves to. Go to the definition of'site.css'in$css, which opensassets/main/site.cssunder$sourcePath. Clear it to complete the files there, and misspell it to see it reported. - Open
config/common/di/application.php. Go to the definition of'name'in$params['application']['name'], which lands on its entry inconfig/common/application.php, or hover it for the type of its value. Clear a key to complete the ones the params files declare beside it, and misspell one to see it reported. - Open
src/Web/HomePage/template.php. Go to the definition of'home.greeting'in$translator->translate(), which lands on its entry in bothresources/messages/en/app.phpandresources/messages/de/app.php, or hover it for the English message. The call names no category, so the ID is looked up in the translator's default one,app. Clear the ID to complete the ones the category declares, and misspell it to see it reported.resources/views/blog/post.phpnames theblogcategory withcategory: 'blog', andPostControllergives its translator that category withwithDefaultCategory('blog'). - Open
resources/views/blog/post.php. Go to the definition of'back-link'in->class(), which lands on its selector inassets/main/site.css, or hover it for the stylesheets that declare it. Clear the string to complete the classes the project's stylesheets declare, a name at a time. - Open
src/Catalog/BookCatalog.php. Hover$bookinfind(): the queryBook::query()builds returns aBook. Go to the definition of'author'inwith(), which lands onBook::getAuthorQuery(), and of'books'inwith('books.author'), which lands on its arm inAuthor::relationQuery(). Each segment of the path is a relation of the record the one before it is for. Indescribe(),'title'inget()goes toBook::$title, and renaming the property renames the string. Clear a name to complete the relations or attributes the record declares, and misspell one to see it reported.Reviewdeclares no properties, so instars()its attributes are the columnssrc/Migration/M251108000000CreateCatalog.phpcreates in its table:'rating'goes to its column there, hovers with its type, completes, and is reported when misspelled. The migrator finds the migration through theyiisoft/db-migrationparams inconfig/console/params.php. IntitlesBy(), ayiisoft/dbquery names its tables and columns as strings:'author'goes to thecreateTable()that creates it, and'b.title'to the column of the table the aliasbstands for, whichTable::BOOK . ' b'names through a constant the migration names it with too. Hover a column for its type, clear one to complete the columns of the query's tables, and misspell a table or a column to see it reported.titles()builds its query over several statements, and the columns the later ones name are read against the table the first one names:'b.title'and'b.author_id'go to their columns, complete, and are reported when misspelled. - In
BookCatalog::shelvedTitle(), hover$title:getValueByPath()walks'book.title'through the entry and into itsBook, so it is astring. Go to the definition of'title', which lands onBook::$title. Clear the path to complete the entry's keys, and type a dot afterbookto complete the properties ofBook. - Open
vendor/yiisoft/router/composer.jsononce the dependencies are installed. Itsconfig-pluginlists the files the package adds to each config group: go to the definition of"di.php"forconfig/di.php, clear a group name to complete the groupsconfig/configuration.phpand the installed packages use, and misspell a file name to see it reported. A"$group"entry goes to the group it names. - Open
config/configuration.php, where the project declares its own config groups. Go to the definition of'common/params.php'for its file, or of'$di'for thedigroup, type$in a list to complete the groups the project and the installed packages declare, and misspell a file name to see it reported.
- Run
composer installin this directory to install Yii. - Open this directory as a project or workspace folder in your editor.
php assertions.php builds the configuration and DI container the way Yii's
web runner does and checks every name the demo declares. To see the
application itself, run php -S localhost:8080 -t public and open
http://localhost:8080/blog.