How to create path for restservice in codeigniter(rest_controller) - php

I am trying to create a studentdb in restful service in codeigniter(rest_controller). I had copied files like
Rest_contoller.php in libraries
Format.php in libraries
Rest.php in config and
rest_controller_lang.php in languages-english
when i am trying to check or load file getting error like
{"status":false,"error":"Unknown method"}
I think i forget to do something regarding the path creation. Can someone check it out please?

Related

Laravel Storage is not able to locate file in Windows

I am developing a package on Windows which publishes the package.php file in config directory of Laravel.
To get contents of package.php I am using Storage Facade. (I know I can use config() to read it but my usecase is different.)
use Illuminate\Support\Facades\Storage;
$contents = Storage::get(config_path('package.php'));
The above code is throwing FileNotFoundException but I have checked that the file is present there and I am also able to access it using config() helper.
File not found at path: C:/xampp/htdocs/blog/config/package.php
Interestingly when I print the config_path('package.php') it returns
"C:\xampp\htdocs\blog\config\package.php"
Notice that the direction of slashes is different in the path shown in
Exception message and the path returned by config_path() helper.
I work mostly on Linux and hence not have much idea about Windows so I am not able to understand what;s going on here.
Please help!
Thanks.
Storage::get() will look only inside the root location configured for the disk.
https://laravel.com/docs/8.x/filesystem#retrieving-files
You can use File facade instead of Storage.
File::get(config_path('package.php'));

How to get access of env() method in base_path() files?

REPHRASED QUESTION
Please atleast check this out https://github.com/vipertecpro/simplesamllaravel.git
it might help others to implement saml integration in laravel.
I've been trying to implement azure saml login integration in laravel so i came across this https://simplesamlphp.org/ , now I've downloaded the whole repo. and put it into my public folder and it's working great, but it's vulnerable so i decided to put it into laravel root directory so that i can get access to environment variable or other laravel helper methods, i've been searching alot how can i get hold onto laravel helper methods inside public folder, but unfortunately it doesn't work , so i decided to put saml repo. into my laravel root directory to get access of laravel helper methods.
so here i am stuck with this problem.
am i clear now ?
Here is the screen shot of my project directory
Problem : I've have many config files which needs to be set as per ENV file, i just couldn't figure it out how can i get use of environment variables into samllogin directory.
Here is what i've tried in my _include.php file which is the root of samllogin directory
require_once '../vendor/autoload.php';
// require_once '../vendor/laravel/framework/src/Illuminate/Foundation/helpers.php';
echo env('APP_URL');
die();
I'm very close to resolve this. Any help or reference appreciated.

connect Braintree php sdk with yii

How can connect Braintree php sdk with yii.I have placed my all sdk files in component folder and calling main file in controller like:
include Yii::app()->basePath.'/components/braintree/lib/Braintree.php';
But this shows error to me include(Braintree_Configuration.php): failed to open stream: No such file or directory.Can anyone help me?
Standard practise to include third party library in Yii (1.x) is to put the code under protected/vendors directory, i.e. protected/vendors/braintree.
Then include this file in your code like this.
Yii::import('application.vendors.*');
require_once('braintree/lib/Braintree.php');
Make sure you have provided read permissions for braintree folder.

blank page opening after uploading codeigniter code to server

I have uploaded Codeigniter code to server but blank page is displayed when opening the URL
I am using codeingniter 2.1.3.
I used MY_Controller.php on application/core/ folder as per specification
I got error in error_log file of codeigniter
"PHP Fatal error: Class 'My_Controller' not found in /home/nesterin/public_html/realstate/application/controllers/administrator/login.php on line 3"
can you tell what i am doing wrong ?
I'm not familiar with codeignighter. But I think if your class name is My_Controller and it's filename is MY_Controller.php autoloader probably won't find the file on a case sensitive file system.
When you upload you need to check these steps:
Change Config file. New versions of CI you can let it blank. CHECK base_url PLEASE! Read documentation
Change database.php and add new data for database. Read Documentation
If you use the MY_Controller, than you need to check if you have the file in core folder and if you extend it correct in Controller too.
Hope that this answer will help you. If you face any problem, comment please!

codeigniter direct file access

I've got a clean install of codeigniter running. I need to access a library file diretly, but i get Access forbidden all the time. Is there any way to fix this? can't find anything about this in the config files etc.
you should try using the codeigniter loader class, if i'm understanding the full question here, example below:
$this->load->library('email');

Categories