Wasp PHP declaration config
I was referencing documentation for next release but cant get type hints for pages and api
Here this works
<?php
use Sin\App;
use App\WebSocket\WebSocketFn;
use App\Auth\Discord\Config as DiscordConfig;
use App\Auth\Discord\UserSignupFields as DiscordUserSignupFields;
use App\Auth\Google\Config as GoogleConfig;
use App\Auth\Google\UserSignupFields as GoogleUserSignupFields;
use App\Auth\GitHub\Config as GitHubConfig;
use App\Auth\GitHub\UserSignupFields as GitHubUserSignupFields;
use App\Auth\Hooks\OnBeforeSignup;
use App\Auth\Hooks\OnAfterSignup;
use App\Auth\Hooks\OnBeforeOAuthRedirect;
use App\Auth\Hooks\OnBeforeLogin;
use App\Auth\Hooks\OnAfterLogin;
use App\Server\Setup;
use App\Server\Middleware;
use App\Client\Setup as ClientSetup;
use App\Pages\Auth\Login;
use App\Queries\GetTasks;
use App\Actions\CreateTask;
use App\Db\Seeds\DevSeedSimple;
use App\Apis\BarNamespaceMiddleware;
use App\Apis\BarBaz;
use App\Jobs\BarJob;
$app = new App('todoApp', [
'title' => 'ToDo App',
'wasp' => ['version' => '^0.16.0'],
]);
$app->auth([
'userEntity' => 'User',
'methods' => [
'discord' => [
'configFn' => DiscordConfig::class,
'userSignupFields' => DiscordUserSignupFields::class,
],
'google' => [
'configFn' => GoogleConfig::class,
'userSignupFields' => GoogleUserSignupFields::class,
],
'gitHub' => [
'configFn' => GitHubConfig::class,
'userSignupFields' => GitHubUserSignupFields::class,
],
],
'onAuthFailedRedirectTo' => '/login',
'onAuthSucceededRedirectTo' => '/profile',
'onBeforeSignup' => OnBeforeSignup::class,
'onAfterSignup' => OnAfterSignup::class,
'onBeforeOAuthRedirect' => OnBeforeOAuthRedirect::class,
'onBeforeLogin' => OnBeforeLogin::class,
'onAfterLogin' => OnAfterLogin::class,
]);
$app->server([
'setupFn' => Setup::class,
'middlewareConfigFn' => Middleware::class,
]);
3 Replies
Hi @Fecony. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I notice you're asking about Wasp PHP, but I should clarify that Wasp is not a PHP framework. Wasp (Web Application Specification) is a declarative DSL (Domain Specific Language) for building full-stack web applications with React, Node.js, and Prisma.
The code you've shared appears to be PHP syntax, but this is not how Wasp works. In Wasp, pages are declared in a
.wasp
file (typically main.wasp
) using Wasp's own syntax, not PHP.
Here's how pages are actually declared in Wasp:
As shown in the tutorial documentation, pages in Wasp are declared using the page
keyword, followed by a name and a component import that references a React component (typically in JSX/TSX files).
If you're looking to work with Wasp, you should be using JavaScript or TypeScript for your application logic, not PHP. The Wasp compiler generates a full-stack application based on your .wasp
file declarations.
For more information about Wasp's page declarations, you can refer to the Pages & Routes documentation.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Fecony, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?@kapa.ai learn that wasp has php version now :milicaboi:
Let me check the knowledge base for you again. One moment! :books:
----------------------
Based on the knowledge sources provided, there is no evidence that Wasp has a PHP version. Wasp is specifically designed as a framework for React, Node.js, and Prisma, as mentioned in the documentation:
"Wasp is using React, Node.js and Prisma under the hood and relies on them to define web components and server queries and actions." Introduction
When asked about language support beyond the current stack, a community member confirmed: "no, not at the moment" and mentioned "there are plans in the future for wasp to become more language agnostic though" Discord support thread.
Wasp is a declarative DSL (Domain-Specific Language) that works with JavaScript/TypeScript, not PHP. The code you shared in your previous message appears to be PHP syntax, but this is not compatible with Wasp's current implementation.
If you're interested in using Wasp, you would need to work with its supported technologies (React, Node.js, and Prisma) and use the Wasp DSL syntax in
.wasp
files as shown in the documentation.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Fecony, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?