Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme is missing config parameters documentation #50

Open
zemian opened this issue Oct 14, 2021 · 9 comments
Open

Readme is missing config parameters documentation #50

zemian opened this issue Oct 14, 2021 · 9 comments
Assignees

Comments

@zemian
Copy link

zemian commented Oct 14, 2021

The Config.php support many more config parameters, but README is not documented it.

Besides this, a note on "basePath" parameter:

By reading the code, I see Config.php support "basePath" parameter. This is needed if user where to place ui.php in a sub path of web server document root. Example (http://myhost/my-app/ui.php). In this case, you must set config like this:

$config = new Config(array(
  'basePath' => '/my-app/ui.php'
  ...
));

Note that the ui.php part is required, or else the style will not render properly!

@zemian
Copy link
Author

zemian commented Oct 14, 2021

I just saw there is a dup issue #6, but I hope my extra note on "basePath" above would help other users.

@mevdschee mevdschee self-assigned this Oct 15, 2021
@mevdschee
Copy link
Owner

Thank you for your issue. I agree that the documentation can be more detailed on getting things running.

@albu77
Copy link

albu77 commented Nov 2, 2021

Speaking about config, is there a way of configuring with the standalone ui.php file the definition["info"]["title"], x-subtitle etc... without changing the source code?

@mevdschee
Copy link
Owner

is there a way of configuring ... without changing the source code?

Well, that is why I added ui.include.php 17 days ago :-)

@albu77
Copy link

albu77 commented Nov 2, 2021

I don't catch how to use this remark...

@mevdschee
Copy link
Owner

mevdschee commented Nov 3, 2021

@albu77 You can create a file named 'ui.php' with config and use:

include 'ui.include.php';

To load a "verified" and "easy to update" version of the software.

In your config file you can add:

'openApiBase => '{"info":{"title":"PHP-CRUD-API","version":"1.0.0"}}'

Like this:

<?php

namespace Tqdev\PhpCrudUi;

include 'ui.include.php';

$config = new Config([
    'api' => [
        'username' => 'php-crud-api',
        'password' => 'php-crud-api',
        'database' => 'php-crud-api',
        'openApiBase => '{"info":{"title":"PHP-CRUD-API","version":"1.0.0"}}'
    ],
    'templatePath' => '../templates',
]);
$request = RequestFactory::fromGlobals();
$ui = new Ui($config);
$response = $ui->handle($request);
ResponseUtils::output($response);

I hope this helps. For more documentation on the config parameters under 'api' see:

https://github.com/mevdschee/php-crud-api#configuration

@mevdschee
Copy link
Owner

mevdschee commented Nov 3, 2021

is there a way of configuring ... without changing the source code?

Another method is the support of environment variables for the configuration of the 'api':

  • PHP_CRUD_API_DRIVER=mysql
  • PHP_CRUD_API_ADDRESS=localhost
  • PHP_CRUD_API_PORT=3306
  • PHP_CRUD_API_DATABASE=php-crud-api
  • PHP_CRUD_API_USERNAME=php-crud-api
  • PHP_CRUD_API_PASSWORD=php-crud-api
  • PHP_CRUD_API_DEBUG=1

and also:

  • PHP_CRUD_API_OPEN_API_BASE='{"info":{"title":"PHP-CRUD-API","version":"1.0.0"}}'

See: https://github.com/mevdschee/php-crud-api#configuration

@albu77
Copy link

albu77 commented Nov 3, 2021

Thanks a lot about all these details. I should read more mindfully the doc....

@mevdschee
Copy link
Owner

@albu77 Don't worry about it, I'm happy to help you! Enjoy the software.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants