Reputation: 3132
This is my current project.hxml:
-cp Source
-main Login
-php Export/Server
-v
What this does is take one of the classes (Login.hx) and use it as the main class for the whole PHP server.
This isn't very useful for PHP, though, as PHP does not really support the notion of a "main" class, instead you'd need a .php script for each function you want to call on the server from the web, working mostly independently from each other.
The biggest problem here is obviously the "main" class as haxe outputs everything into the specified folder, but renames the Login.hx to index.php.
However, I don't want it to become index.php.
What I want is a login.php, logout.php, morestuff.php, basically all of my haxe classes to become callable php scripts, to be able to call them like this:
/appname/login
/appname/logout
/appname/morestuff
etc.
The only ways to achieve this I could think of right now are not-so-nice workarounds.
Surely, there must be a better way?
Upvotes: 1
Views: 158
Reputation: 386
I wrestled with this same issue you are having and this was the best I could do. You can change the filename of the php entry script in the hxml file or command-line option using:
--php-front newfilename.php
You might also find it useful to change where the lib directory is located:
--php-lib ../lib
So the full settings in the hxml file (to generate multiple php entry points) might look like so:
-cp src
-main Main
--php-front joomlahaxe.php
-php bin/com_joomlahaxe/site
-debug
--next
-cp src
-main JoomlahaxeViewJoomlahaxe
--php-front view.html.php
--php-lib ../../lib
-php bin/com_joomlahaxe/site/views/joomlahaxe
Upvotes: 2